COMS W4115
Programming Languages and Translators
Lecture 11: Syntax-Directed Translation
February 25, 2015

Lecture Outline

  1. Syntax-directed definitions and translation schemes
  2. Synthesized and inherited attributes
  3. S-attributed SDDs
  4. L-attributed SDDs

1. Syntax-Directed Definitions and Translation Schemes

2. Synthesized and Inherited Attributes

3. Examples of S-Attributed SDDs

4. Example of an L-Attributed SDD

5. Practice Problems

  1. Using Yacc, implement a syntax-directed translator that translates sequences of postfix Polish expressions into infix notation. For example, your translator should map 345+* into 3*(4+5).
  2. Optimize your translator so it doesn't generate any redundant parentheses. For example, your translator should still map 345+* into 3*(4+5) but it should map 345*+ into 3+4*5.

6. Reading