CS471 Programming Language Structure IFall 1997
- Monkey language consists of the terminal symbols a, b, d, ·
where ·
represents a space. Its grammar is:
á
stopñ
::= b | d
á
plosiveñ
::= á
stopñ
a
á
syllableñ
::= á
plosiveñ
| á
plosiveñ
á
stopñ
| a á
plosiveñ
| a á
stopñ
á
wordñ
::= á
syllableñ
| á
syllableñ
á
wordñ
á
syllableñ
á
sentenceñ
::= á
wordñ
| á
sentenceñ
·
á
wordñ
Which of the following speakers is a monkey in disguise? i.e. which of the following utterances cannot be generated by the grammar?
Gibbon: ba ·
ababadada ·
bad ·
dabbada
Spider: abdabaadab ·
ada
Rhesus: dad ·
ad ·
abaadad ·
badadbaad
- Augment or otherwise change the grammar to include the imposter, i.e. so that the quoted sentences can be generated from the same grammar.
- Rewrite the original monkey grammar (not your changed version) in EBNF form, by replacing all possible recursions by repetitions, and using grouping and optional forms as appropriate.
- Redraw you EBNF grammar in syntax diagram form.
Assignment due: Thursday, September 11th., in class.