Simple Lisp interpretor in Roc based on Peter Norvig's Python implementation.
This is meant as an educational example, for a full-featured Lisp implementation try Racket or SBCL.
- Roc (tested with nightly 070d14a5d60)
roc test
Run an interactive REPL:
roc dev
Exit with Ctrl-D (EOF).
(list 1 2 3)
(quote a)
(define n 5)
(set! n 6)
(define max (lambda (a b) (if (< a b) b a)))
(max 3 4)
=> 4
Values supported:
- Integers (Represented by Roc's I32)
- Lists
- t (true)
- nil (false / empty list)
- lambda (anonymous functions)
- symbols (e.g.
(quote mysym)
)
These are missing but should be easy to implement.
- Floats
- Quote notation (
'(a b)
expands to(quote (a b)
) - Comments