(Derived from oppgave 2 on the mai 1999 exam.)
Consider the grammar G given below.
(1) L -> L E nl
(2) L -> L nl
(3) L -> emptySet
(4) E -> T + E
(5) E -> T
(6) T -> ( E * T )
(7) T -> id
-
Augment G and
convert it to an equivalent LL(1) grammar G'.
-
Compute the FIRST and FOLLOW sets for all non-terminals in the
new grammar G'.
-
Construct the DFA of LR(0) items for this grammar.
-
Construct the SLR(1) parsing table.
-
Show the parsing stack and the actions of an SLR(1) parser
for input string id + id nl