Compiler_Design_Worksheet
Compiler_Design_Worksheet
Page 1 of 2
D → AB | ε
a) Fill in the table below with the FIRST and FOLLOW sets for the non-terminals in
this grammar:
12) 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.
13) Given the following Grammar:
S→A
S→B
A→aAb
A→0
B→aBbb
B→1
a) Construct the SLR parsing table.
b) Write the action of an LR parse for the following string aa1bbbb
Page 2 of 2