] > Interfacing LL(1) Parsers with Code Generators

5.7 Interfacing LL(1) Parsers with Code Generators



X is nonterminal and the parse table provides the ith production rule X α,α at entry (X,a)

push request for semantics action i, requests for intermediate semantics actions, and α into syntaxStack in reverse order



X = a for terminal a

push the semantics value of a into infoStack and scan a new lookahead token a



X = i stands for a production rule number

invoke semantics action i: (1) create code, (2) replace in infoStack the topmost |α| entries with the semantics value of A, if A α is the ith production rule



X =  $ and a =  $

declare success and halt



otherwise

declare error