../
Embeddable & Hackable Lisp-2 Interpreter
git clone https://git.mistivia.com/bamboo-lisp.git
Features:
Drawbacks:
To keep simplicity, Bamboo Lisp is a VERY SLOW tree-walking interpreter. The performance is similar to other small Lisp interpreters like TinyScheme or very early Emacs Lisp, which is only 1/5 to 1/10 that of modern Python.
Summary:
If you want a TinyScheme-like embeddable lisp intereter but in Lisp-2 flavour, Bamboo Lisp is for you.
Install dependency first, see algds for details.
make mode=release
sudo make install
After building, you can run the Bamboo Lisp interpreter using:
./bamboo-lisp # To enter the REPL (if applicable)
./bamboo-lisp <filename.lisp> # To run a Lisp file
You can use load to load a lisp script into the interpreter:
(load "my-script.lisp")
See tests/ for more examples. The tests also serve as documents.
(defun Y (f)
(funcall
(lambda (g) (funcall g g))
(lambda (h)
(funcall f (lambda args (apply (funcall h h) args))))))
(defun fibo-impl (self)
(lambda (n)
(if (<= n 2)
1
(+ (funcall self (- n 1)) (funcall self (- n 2))))))
(defvar fibo (Y #'fibo-impl))
(funcall fibo 10)
;; Expected output: 55
(defmacro inc (x)
`(setq ,x (+ ,x 1)))
(defmacro for (start pred inc . body)
`(let (,start)
(while ,pred
,@body
,inc)))
(for (i 0) (< i 10) (inc i)
(princ "meow\n"))
;; Expected output:
;; meow
;; meow
;; ... (10 times)
Mistivia - https://mistivia.com