Sponsored Links

Cs606 Compiler Construction Assignment No. 2 Fall Semester December 2012


Assignment No. 02
Semester Fall 2012
Compiler Construction CS606
Total Marks: 20
Due Date: 04-12-2012

Question No 1: Marks 10
Considering the following grammar, find the first sets for each non-terminal of the grammar.
S →aS | Ab
A →XYZ | ε
X →cX | ε
Y →dS | ε
Z →eS | ε

Question No 2: Marks 10
Prove that the following grammar is ambiguous because the sentence if ( id == id) then if ( id == id)
then id := id ; else id := id ;can be derived using two different parse trees.
S →id := id ;
S →if (E) then S
S →if (E) then S else S
E →id == id ;