See fredrikmeyer.net/pylisp/ for a literate style documentation.
Run pip install --editable .
. There are no dependencies.
Run tests with pytest
, and linting with flake8 .
> python pylisp/repl.py
Welcome to pylisp.
>((lambda (x) (+ 2 x)) 5)
7.0
>
Or pipe text:
> echo '(+ 1 2)' | plsp
3.0
> python pylisp/repl.py
Welcome to pylisp.
>(define f (lambda (x) (if (< x 2) x (* x (f (dec x))))))
>(f 7)
5040.0
- lambda
- define
- +, and *, <, =, dec
- if
- doc (docstring for built-ins)
- car
- Multiple args
- Simple math functions. Maybe import from Python?
- Quotes
- Macros
- Read from file
I use pyenv to manage Python versions.
Install Python 3.11.1:
pyenv install 3.11.1
Docs are built with pycco
. Build them by running pip install pycco
and pycco pylisp/*.py
. I use a simple search-replace to make eval.py
the index page.
- pavpanchekha/pylisp.
- Peter Norvig: (How to Write a (Lisp) Interpreter (in Python)).
- (An ((Even Better) Lisp) Interpreter (in Python))
- lithp by fogus. Written in perhaps more idiomatic Python.