Lisp in the Rust Type System
A project called "lisp-in-types" implements a Lisp interpreter within Rust's type system, demonstrating how Rust's generic types and trait system can be used to evaluate Lisp expressions at compile time.
Background
- This project implements a Lisp interpreter entirely inside Rust's type system, meaning programs are "executed" at compile time through type-level computations — no runtime code runs.
- Rust's type system is Turing-complete (like C++ templates or Haskell's type-level programming), making this possible if often impractical. Prior projects have simulated Turing machines, lambda calculus, and even a CPU inside Rust types.
- The author's goal is to explore how far Rust's compile-time evaluation can be pushed. This is inherently a "toy" or stunt — no one would actually use it for real work — but it demonstrates the power and flexibility of the language's type machinery.
- For context: Rust does have a built-in `macro_rules!` system and procedural macros for compile-time code generation, but type-level programming is a more extreme, constraint-heavy approach distinct from those.