Next: An Interpreter for Expressions
Up: No Title
Previous: Where to put error
- A parser usually does more than just recognize syntax.
- It could:
- Evaluate code (simple interpreter)
- Emit code (single pass compiler)
- Build an internal data structure (multi pass compiler, interpreter)
- Generally, a parser performs semantic actions
- In a machine-generated bottom-up parser, they are added
to the grammar submitted to the parser generator.
- In a recursive descent parser, semantic actions are embedded
in the recognizer routines.