peklaiho / madlisp
Lisp interpreter for the MadLisp language.
Requires
- php: >=8.3
Requires (Dev)
- phpunit/phpunit: ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-24 10:49:17 UTC
README
MadLisp is a Lisp interpreter and Lisp-to-PHP compiler written in PHP.
MadLisp 2.0 includes a compiler that generates PHP closures for a performance-oriented subset of the language. The evaluated and compiled versions have different capabilities. See the changes for details.
Requirements
The project requires PHP 8.3 or newer and Composer.
Quickstart
Create a new directory and require the project using composer:
$ mkdir mylisp
$ cd mylisp
$ composer require peklaiho/madlisp
Use the vendor/bin/madlisp executable to start the interpreter. Start the REPL with the -r option:
$ vendor/bin/madlisp -r
>
You can evaluate Lisp code interactively inside the REPL:
> (+ 1 2 3)
6
Alternatively you can evaluate a file that contains Lisp code (with optional -p to print out the result):
$ echo "(+ 1 2 3)" > mylisp.mad
$ vendor/bin/madlisp -p mylisp.mad
6
Use -c to run code in compiled mode. Add -s to display the generated PHP source.
Documentation
The full documentation is available on the project website.