A tribute to:
Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I
(as found in paper/recursive.pdf)
A micro-subset of scheme / the original LISP in a single C file: komplott.c
The LISP interpreter translated to Odin in komplodin.odin. More lines of code, but I am less familiar with the language and am translating directly from C, so there are probably ways to make it a cleaner solution.
- Single file implementation.
- Less than 500 lines of code (~750 lines for the Odin version)
- Scheme-compliant enough for the test programs to be executable by GNU Guile (not sure if this is true anymore)
- Copying semi-space garbage collector based on Cheney's Algorithm.
- Limited tail call optimization (not true TCO; see tests/true-tco.scm).
- Near-zero error handling.
- Zero thread safety or security.
Also includes:
An implementation of the core of LISP 1.5 from 1962
-
To build the komplott executable, run make komplott. The only dependency aside from make is gcc.
-
To build the Odin version (komplodin), run make komplodin. This depends on the vendor/back submodule: git submodule init && git submodule update, as well as the Odin compiler.
-
To run the LISP 1.5 interpreter and a couple of test cases, run make test.
The version presented in the README is slightly tweaked from the one that can be found in tests/lisp15.scm in order to more closely resemble early LISP rather than scheme: #t and #f are written as t and nil.
Here is an example of actual LISP 1.5 code:
To prevent reading from continuing indefinitely, each packet should end with STOP followed by a large number of right parentheses. An unpaired right parenthesis will cause a read error and terminate reading.
STOP )))))))))))))))))
.png)

