COMS W4115
Programming Languages and Translators
Lecture 19: Procedures
April 6, 2015

Lecture Outline

  1. Procedures
  2. Parameter-passing mechanisms
  3. Evaluation strategies
  4. Storage-allocation strategies
  5. Activation trees and records

1. Procedures

2. Parameter-Passing Mechanisms

3. Evaluation Strategies for the Arguments of a Procedure

4. Storage-Allocation Strategies

5. Activation Trees and Records

6. Practice Problems

  1. Using the SDDs in Fig. 6.19, 6.36, and 6.37 in ALSU for expressions, if-statements, and booleans, construct a parse tree for the statement if ( x < 10 && x > 20 || x != y ) x = 30; and show the values of all the attributes computed at each node in the parse tree. What is the three-address code that is generated for this statement?
  2. For the C-program in Section 5, draw the activation trees for the procedure calls made during the execution of
    1. gcd(2, 5)
    2. gcd(36, 48)

7. Reading



aho@cs.columbia.edu