COMS W4115
Programming Languages and Translators
Lecture 13: Intermediate Representations
March 6, 2013

Lecture Outline

  1. Syntax-directed translation
  2. Variants of syntax trees
  3. Three-address code
  4. Semantic analysis

1. Syntax-Directed Translation

2. Variants of Syntax Trees

3. Three-Address Code

4. Semantic Analysis

5. Practice Problems

  1. Construct a DAG for the expression
  2. ((x + y) - ((x + y) * (x - y))) + ((x + y) * (x - y))
  3. Translate the following assignments into (a) syntax trees, (b) quadruples, (c) triples, (d) three-address code:
    1. x = a + -(b+c)
    2. x[i] = y[i] + z[i]
    3. x = f(y+1) + 2

6. Reading



aho@cs.columbia.edu