15-212: Principles of Programming

Lecture 23: Evaluation

We now put together lexical analysis and parsing with evaluation. The result is an interpreter that evaluates arithmetic expressions directly, rather than by constructing an explicit translation of the code into an intermediate language, and then into machine language, as a compiler does. Our first example uses the basic grammar of arithmetic expressions, interpreting them in terms of operations over the rational numbers.

In this and the next lecture we extend this simple language to include conditional statements, variable bindings, function definitions, and recursive functions.

Key Concepts

Sample Code

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

Michael Erdmann