A Lisp (Scheme) Interpreter in JavaScript (ES6) referring to lisp.py
at (An ((Even Better) Lisp) Interpreter (in Python))
This project is inspired by Peter Norvig's essay: (An ((Even Better) Lisp) Interpreter (in Python)). The author implemented some Scheme syntax in the interpreter, and this essay discussed the implementation of a Lisp(Scheme) Interpreter in Python.
- Open
lispjs.html
in a browser. The upper text box is used to input Scheme code. - After inputting Scheme code, click
Run
button. Then, the evaluation result of Scheme code will be shown in the lower text box.
Example:
let res = load(`(+ 1 (call/cc (lambda (k) (+ 2 (k 3)))))`);
console.log(res); // expected output: 4
The result will printed in the console.
- Pure JavaScript (ES6); no dependency lib needed; easy to extend and debug
- Follow
lisp.py
's original style and design as much as possible (special change is commented with// Notice:
) - Easy to read and understand with original
lisp.py
Good essay: (An ((Even Better) Lisp) Interpreter (in Python)) by Peter Norvig
John Hardy's lispy2.js