Monday, August 4, 2008

And on a completely different subject

In addition to the Bayesian Hierarchical clustering, I have been playing with my port of MIT Scheme. The code is at http://code.google.com/p/jrm-code-project/source/checkout. Browse down to trunk/MIT-Scheme.

This is a port/rewrite of the MIT CScheme interpreter in C#. It can load and run both the MIT Scheme source code or the syntaxed "bin" files of MIT Scheme. Although it is far from complete, it can cold load MIT Scheme, get to a prompt and start evaluating expressions. Rather that using a huge switch statement like CScheme, this interpreter uses virtual method dispatch to direct evaluation. Tail recursion is achieved via a trampoline. Memory is managed by the CLR runtime.

Why did I do this? I wanted to find out a few things.
  • Is virtual method dispatch fast enough to base an interpreter on?
  • Is the CLR really unsuitable for dynamic languages, or is that a myth?
  • Can MIT Scheme benefit from a more sophisticated GC like in the CLR?
  • What tricks and techniques can we use to improve the performance of the interpreter itself?
I'll blog about this from time to time.

3 comments:

Duncan said...
This comment has been removed by the author.
Duncan said...

Is the current implementation complete enough to run Edwin?

jrm said...

Not yet. And I think you'd want to get the compiler working. Edwin is pretty slow when interpreted.