• Translation rules are in the form:
Rule Semantic_Action
• Semantic_Action is a program routine that specifies what to do if Rule is used.
Special symbols for a rule, r:
$$ = attribute of r’s left-hand side
$i  = attribute of the i-th symbols on r’s right-hand side
Section II: Translation Rules
Example:
expr : expr ‘+’ expr {$$ = $1 + $3}
     | expr ‘*’ expr {$$ = $1 * $3}
     | ‘(’ expr ‘)’  {$$ = $2}
     | INTEGER
     | ID
67/69