[racket] I've implemented a Scheme Interpreter. But it's too slow. Next step?
On Mon, Mar 21, 2011 at 9:42 AM, Patrick Li <patrickli.2001 at gmail.com> wrote:
> How should I proceed from here? These are the options that I've come up
> with:
> (1) Optimize variable lookup. Currently the environment is represented as a
> list of key-value pairs. Variable lookup is done by searching through the
> list.
> (2) "Analyze" the code before evaluating it (ie. as in SICP). Ie. for an
> (if) form, it will determine that it is an if form during the analysis
> phase, so that at execution stage it won't have to repeatedly figure out
> what sort of form it is.
> (3) Write a very simple VM, and develop a simple byte-code compiler. The
> problem here is that I don't really know how to deal with first-class
> continuations.
If you want to implement a VM you may want to read Dybvig's PHD dissertation:
http://www.cs.indiana.edu/~dyb/pubs/3imp.pdf
Cheers,
Sam