A minimal, eXecutable, self hosted lisp.
x is a programming language. This repo makes x code eXecutable in a few ways.
It is a subset of MIT Scheme's syntax and has its own minimal standard library.
./xsadapts MIT scheme to match the x runtime.
Further, x itself is sufficient to:
- write its own interpreter (
xi.x) - write its own compiler (
xc.x) - pass unit tests for each language feature (
test.x) - solve Advent of Code puzzles (
aoc/)
Download MIT Scheme.
You should be able to run:
schemeAnd get a prompt back.
Run:
./bootstrapYou should now have three x runtimes:
./xsa wrapper around scheme./xia native x interpreter./xca native x compiler
All accept x code from stdin and run it.
for x in ./xs ./xi ./xc; do
echo "(println (+ 1 2))" | $x
doneTo have xc only compile and not run, use -o <path> e.g.
./xc -o /tmp/output.bin < code.xNote: all three runtimes support tail recursion.
Because the x interpreter and compiler are written in x themselves, one can chain them together after bootstrapping with the scheme runtime.
To verify that chaining the runtimes together in different orders reproduces the same results, including the "fixed point" that the compiler can reproduce itself byte-for-byte, run:
./verifyNote: for performance reasons, this limits to chains that do not run nested
interpeters, and even then, the Ic* checks still take a minute. See the
nesting experiment to explore this further for the x
runtime or the minimal eval to explore several levels
of nesting for a simpler runtime.
See aoc/ for solutions to Advent of Code puzzles written in x.
You can run with any runtime e.g.:
./xs < ./aoc/2025/day1.x
./xi < ./aoc/2025/day1.x
./xc < ./aoc/2025/day1.xSee exp/ for some motivating or follow-on experiments to x.
- See how the
nullsolution actually passes verification. - See a minimal
evalthat can evaluate itself. - See how nesting runtimes works.
- See how a trusting trust attack is implemented in x.
- See how to reify control flow with
call/ccin x.