15-312 Foundations of Programming Languages
Lecture 26: Environments
In this lecture we return to some questions of implementation
and efficiency for MinML. The principal semantics descriptions
we have given, namely the structured operational semantics and
the C-machine, both employ substitution of expressions for
variables in expressions. This results in a clean and high-level
specification, but it is not very close to a realistic implementation.
In this lecture we introduce environments, which bind
variables to values at run-time. We never substitution, but instead
evaluate expressions in environments. This leads to a number of
new considerations, in particular we need to pair up expressions
with their environment in closures. We sketch how to
relate the environment semantics to the substitution semantics
via a bisimulation theorem.