on bootstrapping: introducing Mes

June 19, 2016


I have a minimal LISP-1.5-resembling interpreter in C that now can also interpret itself


It was inspired by the seemingly often ignored bootstrapping question made so painfully visible by GuixSD and by OriansJ with their self hosting hex assembler project.

As a next step after a hex assembler I was thinking of getting Scheme up and running and use that to create a tiny C compiler, probably using PEG. For that I think we need define-syntax, which I had a peek at and still scares the all-sorts-of-things out of me :-)

I searched for minimal Lisp/Scheme to get that going and found an article called the Maxwell Equations of Software with a pointer to the 1962 LISP 1.5 paper by John McCarthy.

First I `implemented' Mes/LISP-1.5: the bottom half of page 13 and the necessary helper procedures defined on pages 8-12 using Guile, removing all but the primitives needed to run LISP-1.5/Mes (I think): car, cdr, cond, cons, define, eq?, '()/nil, null?, pair? and quote. I cheated with read, and with display and newline for debugging.

Then I translated the program into C and got rid of read by using getchar/ungetchar.

It's been great fun and now I'm kind of stuck a bit at the point of implementing macros. I have a simplistic version in C but want to remove that again --I like the idea of having the absolute minimal LISP interpreter in C-- and only introduce macros after having bootstrapped into the LISP/Mes domain.


  1. Maxwell Equations of Software
  2. 1962 LISP 1.5