rui314/minilisp
FreeA readable lisp in less than 1k lines of C
FreeFree tier
About rui314/minilisp
MiniLisp is a Lisp interpreter written in less than 1000 lines of C, designed for readability and education. It supports integers, symbols, cons cells, global and lexically-scoped local variables, closures, conditionals (if), loops (while), primitive functions (+, -, =, <, >, list), user-defined functions, a macro system, and a copying garbage collector. The code is heavily commented to aid understanding. It implements a traditional read-eval-print loop and includes a comprehensive test suite. MiniLisp has been tested on Linux x86/x86-64 and 64-bit Mac OS.
Key Features
Readable codebase under 1000 lines of C
Supports integers, symbols, cons cells
Lexically-scoped local variables and closures
User-defined functions
Macro system
Copying garbage collector
Comprehensive test suite
Heavily commented for readability
Primitive functions: +, -, =, <, >, list
Conditionals (if) and loops (while)
Pros & Cons
Pros
- Extremely readable and well-commented code
- Small codebase makes it easy to understand
- Includes advanced features like closures and macros
- Comes with a comprehensive test suite
- Supports garbage collection
- Real Lisp interpreter in under 1000 lines
Cons
- Only supports integer numeric type, no floating point or strings
- Limited standard library (no built-in list operations beyond car/cdr/cons)
- Not intended for production use, primarily educational
- Lacks error handling beyond basic evaluation
- Only tested on Linux and macOS
Best For
Learning how a Lisp interpreter worksEducational tool for programming language implementationExploring macros, closures, and garbage collection in a minimal LispReference for building small interpreters
FAQ
What is MiniLisp?
MiniLisp is a small Lisp interpreter written in less than 1000 lines of C, designed to be readable and educational. It is a weekend project by rui314.
What features does it support?
It supports integers, symbols, cons cells, global and lexically-scoped local variables, closures, conditionals (if), loops (while), primitive functions (+, -, =, <, >, list), user-defined functions, macros, and a copying garbage collector.
How do I compile and run it?
Run 'make' to compile. Then run './minilisp' to start the REPL. Use 'make test' to run the test suite.
Is it suitable for production use?
No, it is primarily an educational tool to demonstrate Lisp interpreter implementation. It is not intended for production use.