Syntax-Directed Translation: ASU Textbook Chapter 5
Syntax-Directed Translation: ASU Textbook Chapter 5
Tsan-sheng Hsu
http://www.iis.sinica.edu.tw/~tshsu
1
What is syntax-directed translation?
Definition:
• The compilation process is driven by the syntax.
• The semantic routines perform interpretation based on the syntax
structure.
• Attaching attributes to the grammar symbols.
:= :=
id + id +
(y)
* id * id
(z)
const id const id
(3) (x)
parse tree annotated parse tree
D D
T L L j
int L , j L i ,
T
i
int
:= :=
id + id +
(y) (y)
* id * id
(z) (z)
const id const id
(3) (x) (3) (x)