SDT

2026-11-18

notes / Compilers

Course: Compilers Date: 2025-09-12

Syntax Directed Translation

Slides

The role of Syntax Directed Translation is

Syntax Directed Definitions

You basically create an annotated grammar: where beside every production you have the semantic rule associate with it

production semantic rule
T -> FT' T'.inh = F.val
T.val = T'.syn
T' -> *FT' T'.inh = T'.inh x F.val
T'.syn = T'.syn
T' -> eps T'.syn = T'.inh
F -> digit F.val = digit.lexval

Attributes

  1. synthesized: passed up the syntax tree
  2. inherited: passed down the syntax tree

Evaluation Orders of SDD

Important SDDs

Computing Types and Their Width

3 Address Codes

Backpatching

linked from