COMS W4115
Programming Languages and Translators
Lecture 15: Intermediate Code Generation
March 25, 2013

Lecture Outline

  1. Intermediate Representations
  2. Semantic analysis
  3. Purpose of types in programming languages
  4. Type systems
  5. Typing in programming languages
  6. Type inference rules
  7. Type conversions

1. Intermediate Representations

2. Semantic Analysis

3. Purpose of Types in Programming Languages

4. Type Systems

6. Typing in Programming Languages

7. Type Inference Rules

8. Type Conversions

9. Practice Problems

    The following grammar generates programs consisting of a sequence of declarations D followed by a single expression E. Each identifier must be declared before its use.
  1. Construct type expressions as in Section 6.3.1 (pp. 371-372) for the following programs:
    1. int a; int b; a + b
    2. float[10][20] a; a[1] + a[2]
  2. Write pseudcode for a function sequiv(exp1, exp2) that will test the structural equivalence of two type expressions exp1 and exp2.
  3. Show how your function computes sequiv(array(2, array(2, int)), array(2, array(3, int))).

10. Reading