femtolisp: A lightweight, robust, scheme-like Lisp implementation
femtolisp is a lightweight, Scheme-like Lisp implementation aiming for extreme conciseness and speed, born from an effort to build a fast Lisp interpreter in under 1000 lines of C. It champions a "do Lisp right" philosophy, integrating critical features often overlooked by other minimalist implementations. The project resonates on HN for its technical ambition, strong opinions on Lisp design, and commitment to a powerful yet tiny core.
The Lowdown
femtolisp is presented as a lightweight, robust, Scheme-like Lisp implementation, originating from a personal challenge to build the fastest possible Lisp interpreter in under 1000 lines of C. The project evolved to integrate powerful features while maintaining minimal code, using a curated library of C code for its standard library. The author emphasizes its small footprint (around 150kb) and self-contained nature, positioning it as a thoughtful alternative to the myriad of existing Lisp implementations.
- Core Features: It includes vectors, strings, gensyms, backquote support, exceptions, and robust handling of circular and shared structures. It also offers prettyprinting, hash tables, and direct C data type integration akin to Python's ctypes.
- Performance & Design: femtolisp boasts proper tail recursion, UTF8 support for I/O and memory streams, and is highly compatible with Scheme, including R6RS features. It utilizes a bytecode compiler and VM (with the compiler itself written in femtolisp) and is noted for being among the fastest non-native-compiled Scheme implementations, despite many primitives being Lisp-implemented.
- Architectural Philosophy: The design prioritizes a simple, well-organized API, a compacting garbage collector, and a Lisp-1 with lexical scope. A key goal is code conciseness and reliability, with concepts implemented in single, easy-to-understand locations.
- Critique on Lisp Implementations: The author strongly critiques other Lisp projects for often omitting crucial features (like read macros, gensyms, escaped symbols) or introducing