Compiler Design Assignment
Compiler Design Assignment
Page 1 of 3
D AB | ε
a) Fill in the table below with the FIRST and FOLLOW sets for the non-terminals in
this grammar:
12) Let G be the following grammar:
S [ SX ] | a
X ε | +SY | Yb
Y ε | -SXc
a) Find FIRST and FOLLOW sets for the non-terminals in this grammar.
b) Construct predictive parsing table for the grammar above.
c) Show a top down parse of the string [a+a-ac]
13) Consider the following grammar:
S ScB | B
B e | efg | efCg
C SdC | S
a) Justify whether the grammar is LL(1) or not?
b) If not, translate the grammar into LL(1).
c) Construct predictive parsing table for the above grammar.
14) Given the following Grammar:
SA
SB
AaAb
A0
BaBbb
B1
a) Construct the SLR parsing table.
b) Write the action of an LR parse for the following string aa1bbbb
GOOD LUCK!
Page 2 of 3