Thursday, June 18, 2009

“The night was quiet — too quiet.”

Time to restart posting. I have a bunch of half-finished posts. I think I was trying to write too much in one sitting. I'm going to write smaller things, but I intend to write more frequently.

Big news today: my C# version of MIT Scheme can now self-host. (I would say that it is self-hosting, but I don't want to tempt fate that much.) When I started, I was loading the SCode binaries that were created by the native Windows version of MIT-Scheme (with the runtime written in C). My bootstrap fasloader would translate the binaries into .NET data structures on the fly. Unfortunately, I couldn't create these binaries without the original syntaxer from MIT-Scheme. But I have managed to get the syntaxer to re-generate the binaries. The C# binaries have a completely different format from the original binaries. This is because I simply serialize the data structures into the file using the built-in C# serialization protocol. The fasloader now attempts to load binaries by first attempting to deserialize them, and if that fails, falling back on the bootstrap fasloader that understands the original binary format.

So I have a bootstrap runtime built out of the original binaries. I boot from them, and then use them to create a new set of binaries. I booted from the new set, created a second generation set of binaries, and saved them. Now I can boot from the second generation and create the next generation without needing a native MIT Scheme executable. (Again, in theory. I might have second or third generation bugs waiting to prove me wrong, so I'm not discarding the original code quite yet.)

I'll upload the latest code in a short while.

2 comments:

kbob said...

I'd love to know more about the bootstrap process if you feel like writing about it.

I'm teaching myself Scheme by writing an interpreter in C. (Yeah, seriously.) There is definitely lore that isn't in the textbooks, and the bootstrapping process is part of it.

If you're interested in seeing a Lisp outsider's attempts to grok your language, here are some notes.

http://kernelbob.wordpress.com/2009/05/21/scheming-part-7-the-reader/

Joe Marshall said...

I think that writing your own interpreter is a fantastic way to learn about a language and computing. I've hired a couple of junior programmers because they decided to teach themselves Lisp or Scheme by writing an interpreter. Both turned out to be absolutely stellar programmers.