Tiny Lisp interpreter. written in TypeScript.
- set node version:
16 >=
npm install
for install dependenciesnpm start
for run repl
lisp-ts> (+ 1 (- 2 (* 3 (/ 4))))
-9
lisp-ts> (&& (|| false true) (> 1 0))
true
lisp-ts> (setq x 5)
true
lisp-ts> x
5
lisp-ts> (+ x x)
10
lisp-ts> (defun fn (x) (* x x))
true
lisp-ts> (fn 2)
4
recursive function
lisp-ts> (defun fact (n) (if (== n 0) 1 (* n (fact (- n 1)))))
true
lisp-ts> (fact 5)
120
- add environment scope
Create interpreter is one of awesome experience in my programming life.
thanks for next articles and all lisp programmers.
- Land of Lisp [book]
- Little Lisp interpreter - Mary Rose Cook
- kanaka/mal - mal - Make a Lisp
- Indy9000/lisper - Lisp Parser Interpreter written in TypeScript
- (How to Write a (Lisp) Interpreter (in Python))
- and translated article ((Python で) 書く (Lisp) インタプリタ)
- JavaScript で Web ブラウザ版 LISP 処理系を作ってみた
- JavaScript の ES2015 を使ったら Lisp を 100 行未満で実装できた