CS471 Programming Languages I
Fall 1996

Assignment: Syntax

This assignment test understanding of BNF grammars, parse trees, the EBNF formalism and syntax charts.

"Genius Baby" language

Below is the EBNF grammar of the language spken by babies with I.Q.'s of more than 200. They always follow the rules of the grammar very closely so as not to appear stupid. Note that the superscript on the repetition braces means "at least one".

word ::= ['a'] {'da''da'}1 'd' | ['a'] {'ma' 'ma'}1 'm' | {'mm'}
sentence ::= {word}

The imposter

One day at pre-school, after the advanced calculus class, three babies were talking. Below are three of their utterances.

  1. Show that one of the babies is not a real genius, but an imposter. Do this by drawing the parse trees for the two utterances that can be generated by the grammar, and showing that the third cannot have a complete parse tree.

    baby 1: dadadamamammmmm
    baby 2: amamamamammmdadadmm
    baby 3: dadadamamamammamamam

  2. Now show that a simple change to the rule for word can allow the imposter to become a real genius (her I.Q. was after all a mere 198).
  3. Transform the original grammar (unaltered) into straight BNF notation.
  4. Transform the original grammar (unaltered) into syntax chart form.

Due date

Hand in your completed assignment by Thursday, September 19th., in class.