MiniLisp C++: A Compile-Time Lisp Interpreter in C++20

TL;DR: I built a Lisp interpreter that evaluates expressions at compile-time using C++20 constexpr. The same code works at runtime too—no duplication needed. Along the way, I discovered that macOS adds ~28KB of constant overhead to all C++ binaries, and that Mach-O is surprisingly more efficient than Linux ELF for small programs. Try it right now — this runs the same interpreter compiled to WebAssembly (27KB): Lisp Expression: Eval Result: Loading WASM... Try: (* 6 7) · (car '(10 20 30)) · (cdr '(1 2 3)) Some weeks back I saw that Dan Lemire had a PR open on simdjson that added an expression to parse whole JSON. That intrigued me and took the challenge to see if I could write a LISP Interpreter. Here’s a minimal godbolt playground if you’re interested to play around. I don’t have this problem as much anymore but I used to need a little DSLs in programs all the time. Maybe long term Lua is right choice but I can see something like this to be useful in a very small form factor like some kind of verified binary that you want to minimize your dependencies and adding a whole new lib will add more complexity. ...

December 26, 2025 · 9 min · NextDoorHacker