~knazarov/lisp.py

A lisp interpreter written in Python
Implement more hash and set operations
Implement symbol interning
Implement set hashing and raising errors

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~knazarov/lisp.py
read/write
git@git.sr.ht:~knazarov/lisp.py

You can also use your local clone with git send-email.

#A lisp interpreter in Python

This is a simple lisp interpreter written in standard Python, without dependencies.

Supported features:

  • REPL
  • loading of code from files
  • lists
  • basic arithmetic
  • closures
  • lambdas
  • garbage collection
  • tail recursion
  • macros

Features to come:

  • continuations
  • coroutines
  • exceptions
  • extended standard library
  • CPS transformation and lambda lifting

#How to run

Currently, the only way to interact with the interpreter is through REPL. Run it like this:

./repl.py

In the REPL, you can type a factorial function:

(define (fac n) (if (< n 2) 1 (* n (fac (- n 1)))))

And then call it:

(fac 4)