Pachuco

Pachuco is a self-hosting compiler for a dialect of the Lisp programming language (and it also has a lot in common with Scheme). It generates i386 or x86-64 assembly code directly, rather than compiling to another high-level language or virtual machine. The system is about 5000 lines of code, including the compiler, runtime, garbage collector, and interpreter (used in the macro system). The whole system is written in the Pachuco language, except for a minimal amount of C and Common Lisp code to allow the system to be bootstrapped. Pachuco is Free Software, distributed under the MIT/X11 license.

The Pachuco language is very modest in comparison to Common Lisp and Scheme, lacking facilities and conveniences not required for the compiler. Nonetheless, the concise implementation of the compiler demonstrates the expressive power of such a simple dialect of Lisp.

The language is briefly described in the LANGUAGE file. Like Scheme, the language features a small core, lexically-scoped variables, and supports proper tail recursion. But the macro system and the library functions in the runtime are based on Common Lisp.

Like a C compiler, the Pachuco compiler produces stand-alone executables. Unlike traditional Lisps, it is not integrated into a read-eval-print loop, although the system does include a simple interpreter-based REPL.

The current implementation of Pachuco has a number of limitations, and it is very spartan in comparison to production compilers (e.g. its error reporting is almost non-existent). It is probably not yet suitable for other applications.

If you find Pachuco interesting, you may want to subscribe to my weblog, where I'll be writing about it and related topics.

David Wragg