a predictive parser
elements of a parser
parsing actions: mutually recursive procedures
tests: to predict which parsing actions to apply
handling of input: how symbols are consumed, how lookahead works
example of a parsing action
- the rule
- turns into the code
(define (parse_pgm)
(if (end?)
'()
(let*
((s (parse_stmt))
(p (parse_pgm)))
(cons s p))))
- note this code embodies
the grammar rule
and the construction of the abstract syntax