15-212: Principles of Programming

Lecture 24: Interpreters and Recursion

We introduce declaration environments, type environments, and value environments, to distinguish between static declarations and runtime evaluations. The parser produces declaration environments. The type-checker uses the declaration environments to build type environments, and thus perform compile-time type-checking. The evaluator uses the declaration environments to build value environments, and thus perform execution-time evaluation.

We extend our set of values to include functions. In order to do this properly, we introduce the notion of a closure, which encapsulates the function definition as an expression together with the necessary variable bindings in the value environment.

Key Concepts

Sample Code

[ CS 15-212 Home page | schedule | language | assignments | handouts ]


Michael Erdmann