COMS W4115
Programming Languages and Translators
Lecture 16: Translation of Statements
March 27, 2013

Lecture Outline

  1. Logical rules of inference for type checking
  2. Run-time storage organization
  3. Translation of assignments
  4. arrays
  5. Boolean expressions
  6. If-statements
  7. While-statements

1. Logical Rules of Inference for Type Checking

2. Run-time Storage Organization

3. Translation of Assignments

4. Arrays

5. Boolean Expressions

6. Translation of If-statements

7. Translation of While-statements

8. Practice Problems

  1. Use the SDD of Fig. 6.22 (ALSU, p. 383) to translate the assignment x = a[i][j] + b[i][j].
  2. Add rules to the SDD in Fig. 6.36 (ALSU, p. 402) to translate do-while statements of the form:
  3.    Sdo S while B
    Show the code your SDD would generate for the program
    
         do
           do
             assign1
           while a < b
         while c < d
      

9. Reading



aho@cs.columbia.edu