[racket] metacircular interpreter, lexical scope, environment
On Wed, Dec 1, 2010 at 5:25 PM, David Van Horn <dvanhorn at ccs.neu.edu> wrote:
>
>
> An evaluator can implement function application using substitution, i.e.
> you can evaluate ((lambda (x) e) v) by evaluating the substitution of v for
> x in e.
>
> Or, you can be lazy and defer the substitution. In that case, you evaluate
> ((lambda (x) e) v) by evaluating e; you just have to remember that v should
> have been substituted for x should you ever get to evaluating x. The data
> structure you use to remember those deferred substitutions is an
> environment. A simple list of variable, value pairs is a suitable
> representation.
>
Thanks - I have read the substitution part of PLAI and thought of using
substitution as well, but it seems that substitution does not constitute the
full solution:
- it only work with side-effect free code
- it does not address closure
Maybe I am looking too far ahead, but it seems like I cannot get away from
needing my own call stack? Or am I missing something?
Thanks,
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101201/0aabf33c/attachment.html>