CS606 Assignment 02 Solution Spring 2013 Due Date:16-05-2013

No Comments

a) Show that the grammar
is ambiguous by finding a string that has two different syntax trees.
Now make two different unambiguous grammars for the same language:
a) One where prefix minus binds stronger than infix minus.
b) One where infix minus binds stronger than prefix minus.
Show the syntax trees using the new grammars for the string you used to prove
the original grammar ambiguous.


Question No 2: Marks 10
Consider the grammar
A → B C D
B → h B | ε
C → C g | g | C h | i
D → A B |ε
Fill-in the table below with the sets First and Follow. Remember to put ε in the set First(X) whenever X can reduce to the empty string.

First Follow
A
B
C
D

Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment