Skip to main content

Section C.24 O3: Syntax-Directed Code Generation


  • Simple code generation technique that generates very inefficient code.

  • Syntax-driven: compose code of an AST node from code of its children and “glue code”

  • Three code-gen functions: L-eval, R-eval, and statements.

  • All local variables are kept on the stack for simplicity.

  • Sethi-Ullman numbering can be used to decide non-determinism in binary operators based on register demand.

Sections Covered.

Section 9.3