] > Interfacing LR(1) Parsing with LL(1) Parsing and Code Generation

7.12 Interfacing LR(1) Parsing with LL(1) Parsing and Code Generation

Push the start symbol ‘<program>’ into the stack, and repeatedly act according to the entry on top of the stack.

Nonterminal symbol other than <expr>
Consult the LL(1) parse table, pop the nonterminal symbol, and push ‘rule number+right hand side’ in reverse order.
Terminal
Match against the input, and push the semantics information into the INFO stack.
Rule number
Call semantics action.
Empty
Terminate compilation
The nonterminal symbol <expr>
Replace the nonterminal with the start state of the LR(1) parser.
State
Shift/reduce according to the LR(1) parse table. On reduce call semantics action; on shift push the semantics information of token to INFO.