Parser
Parser
Q1 LL (1) Parsers
In the following context-free grammar, the symbols 0, 1, 2 and 3 are terminals and S is the initial symbol.
S → 0|1S2S3|1A3
A → S|AS
c) Left factorize it
e) Using stack, show all the steps required to parse the input string: 11020301033
Q2 LR (1) Parsers
In the following context-free grammar, the symbols (, a, ) and , are terminals. And S is the initial
symbol.
(1) S → ( L )
(2) S → a
(3) L → L , S
(4) L → S
a) Construct the full LR (1) DFA, showing all items in each state.
b) Construct the LR (1) parsing table using the DFA. For the reduce actions, please use the
provided enumeration of the productions in the grammar.
c) Using stack, show all the steps required to parse the input string: (( a , a ) , a , a )