Answers to Self-Study Questions

Test Yourself #1

Here is the original grammar:

There are no epsilon or unit rules. First, we'll handle rules with terminals on the right, converting the CFG to the following:

Next we'll handle the rules with more than one nonterminal on the right, converting the CFG above to the following:


Test Yourself #2


Test Yourself #3

Yes, the input x ++ y = z y ++ is in the language of the simple statement grammar. We know this because the grammar's start nonterminal, S, is in the upper-right corner of the grid.