Skimp
Skimp is my own unfinished and minimalist Scheme interpreter. The
design is simplistic, and so far has the following technical
characteristics:
- the primary target is 8 bit systems based on the Z80 CPU (specifically the
Sinclair ZX
Spectrum)
- it also runs on 16 (?), 32 and 64 bit systems, using the same source
- it's written in portable C, currently targeting z88dk, SDCC and GCC
- it supports integer numbers only for now (but is ready for more numeric types)
- it uses simple non-moving mark-and-sweep garbage collection for now
- for now, the stack is implemented as a chain of cons cells, in preparation
for continuations,
exceptions and threads
It speaks
Early days yet, but during a couple of enthusiastic hacking sessions while
on Summer holiday in Italy, Skimp started talking back. It's a surreal moment
when a new interactive language interpreter come to life... like
something with legs just strolled out of your primordial C program and asking
for a pan galactic gargle blaster.
Welcome to Skimp 0.000001
> 42
42
> (+ 1 2)
3
> (define f (lambda (n) (+ 1 n)))
#<procedure:(n):((+ 1 n))>
> (f 41)
42
Well it's not much but it's a start... the foundations are in place
(garbage collection, reader, pretty printer, symbols, cons/car/cdr,
procedures and environments, eval/apply with the correct variable scoping).
But I think it will be quite some time
before I can report that this page is being served up by Skimp on a ZX
Spectrum :-)
Wishlist
Some of my longer term goals for this project are:
- macros
- serial port access
- more sophisticated garbage collection
- performance optimisations
- simplistic JIT compilation
- a simple thread and readiness based IO system
- a simple working network stack using SLIP, in some combination of
Scheme and Z80 assembler
Relevant texts
Lisp dialects - what can I say, it's addictive. These
are my current favourites. (Stangely, there's one for each decade.)
- LISP 1.5 Programmer's Manual, John McCarthy et al, 1962
- The Little Schemer*, Daniel P Friedman, first published as The Little Lisper, 1974
- Structure and Interpretation of Computer Programs, Harold Abelson and Gerald Jay Sussman, 1985
- The Scheme Programming Language, Kent Dybvig, 1996
- Principes d'implantation de Scheme et Lisp, Christian Queinnec, 2007
* This is the one that got me started with Scheme. I expect that
anyone who reads this book will finish up becoming a raving mad Scheme
addict.
Other 8-bit Lisps
I have found references to the following commercial or academic
8-bit Lisps (although I was never lucky enough to use any of these when I
was a nipper and the Z80 was my weapon of choice, back in my day we had
assembler and BASIC and we thought we were lucky!)
- VLisp, Jérôme Chailloux, 1979
- Le Lisp 80, Jérôme Chailloux, 1983 (Z80 assembler source available, targets many 8 bit systems including CP/M)
- Toolworks LISP/80, Walt Bilofsky, for Z80 under CP/M
- InterLisp/65 for the Atari 6502 machines
- Acornsoft Lisp for the BBC 6502 machines, 1984
- SpecLisp, Serious Software, for the ZX Spectrum, 1983
- P-Lisp, Gnosis Software, for Apple 6502 machines, 198x
- Z80 Scheme, by Ken Dybvig and George Cohn, mentioned in The Development of Chez Scheme
Google and I have found the following modern 8 bit Lisp projects, in
various states of completeness:
Lisp quotes
- Greenspun's often quote Tenth Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
- Robert Morris added "Including Common Lisp".
- Seen spay-painted on the side of the number 24 bus: "Any sufficiently complicated C or Fortran programmer has a home directory containing an ad-hoc, informally-specified bug-ridden slow implementation of half of some Lisp dialect or other".