Thursday, March 8, 2007

Working on a language...

There hasn't been much of an update here for some time now, and there's a good reason: I've been working on all kinds of stuff most of which is not in the state of offering anybody anything yet.

This might get a bit too technical for this blog, but the latest thing I've been working with is an implementation for a Scheme like language, with some specific design goals:

  1. Make it compile to truly native code, such that it can be used to implement it's own runtime system, ultimately including the whole operating system, if desired.
  2. Make it able to bootstrap itself on the fly, dynamically replacing the running version without requiring a restart. As a related feature, (almost) all code should be garbage collectible.
So far I have a basic compiler written in Scheme that compiles to x86 assembler. It's nowhere near being able to compile itself yet (and the language differs enough to require a port eventually), but it's properly tail-recursive, can deal with variable arguments and multiple return values without allocating any memory (except that receiving "rest" arguments into a list will obviously allocate said list), and requires minimal external runtime support; a few lines of C to get stuff going and a bit of assembler for apply primitive.

Road map for now is to finish the remaining missing features in the basic language, get linking of libraries to work, add a basic garbage collector, write a meta-circular interpreter, get a REPL running, port the compiler to run on top of the interpreter, extend the compiler to run just-in-time, and then figure out how to get the system to dump it's full state into a file such that it can be resumed. Once all that works, the rest should be relatively easy.

One would think there are already enough Scheme implementations, but this one will be different. ;)