Bobbing for Kernels

See Bob. See Bob bob. Bob, Bob, bob!

Scheming, part 1

Posted by kernelbob on September 25, 2008

I have a Scheme interpreter.

~/scheme> ./scheme
> ()
> 123
> +
#<C-proc 0x804ad19>
> (+ 12 34)
> (lambda (x) x)
#<proc 0x80590f8>
> ((lambda (x) (+ x x)) 3)
> [Ctrl-D]

There’s less here than meets the eye.  The interpreter has exactly three built-in procedures: +, – and lambda.  The only numbers are fixnums (fixed-size integers).  There is no garbage collection – it calls malloc() but doesn’t call free(). The reader doesn’t recognize quotes, dotted pairs, or comments.  There are no vectors, hashes, byte arrays, etc.  No exceptions, call/cc, threads, etc.  No tail recursion.

I wrote it in C, as promised.

Once upon a time, I wrote an emacs clone. It was the style back then to name emacs clones with recursive acronyms.  We had MINCE (MINCE Is Not Complete Emacs), EINE (Eine Is Not Emacs) and ZWEI (Zwei Would Emacs Emulate).  Mine was MINE, which stood for “MINE Is Not Emacs, but it’s mine”.

This scheme interpreter is nothing special, but it’s mine.



One Response to “Scheming, part 1”

  1. […] Scheming, part 1 […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: