CS 115
Environment Model of Evaluation
To evaluate an expression in an environment E:
1. If the expression is a symbol, look up its binding in E, and you're done.
Otherwise, the expression is a list, continue.
2. Evaluate the subexpressions of the list (i.e. the operator and operands)
in E.
3. Apply the operator to the operands.
a. Create a new frame
i. In this new frame, bind the formal parameters of the operator
with the values of the operands obtained in step 2.
ii. The enclosing environment of this new frame is the definition
environment of the procedure being applied.
b. Evaluate the body of the operator (it's an expression)
in this newly constructed frame.
c. You're done.
Notes: DEFINE alters the current frame, LET creates a new one.
Peter Kimmel (kimmel@cs.uchicago.edu)