Scheme from Scratch - Bootstrap v0.21 - Standard Library

With I/O in place, especially the load form, we can continue to expand our Scheme implementation by programming new compound procedures in Scheme. The standard library defines forms like cadr, map, not, etc. Feel free to add whatever you think you would like to have available.

A sample REPL session:

$ ./scheme
Welcome to Bootstrap Scheme. Use ctrl-c to exit.
> (load "stdlib.scm")
stdlib-loaded
> (define (double x) (* 2 x))
ok
> (map double '(0 1 2 3)) 
(0 2 4 6)

There is no C programming for this version. That feels like a move in the right direction given a bootstrap interpreter is to eventually allow programming in the implemented language.

Three weeks to the day and even though there isn’t garbage collection, the functionality of the language is complete. As long as programs are not too big, run too long, or process too much data, the experience of using your bootstrap interpreter is what it set out to be. Sit back and enjoy watching it run. :-)

There is a v0.21 branch on github for this version.

Previous article: I/O
Next article: Garbage Collection

Comments

Have something to write? Comment on this article.

Jim Ingram January 26, 2010

I’m just a couple of output procedures behind you with bs.

One change I made was with the load primitive; it takes an optional environment parameter. If you use it, the contents of the file are evaluated in that environment instead of the global one.

Have something to write? Comment on this article.