diff options
Diffstat (limited to 'lisp/js')
-rw-r--r-- | lisp/js/README.md | 24 | ||||
-rw-r--r-- | lisp/js/l.html | 17 | ||||
-rw-r--r-- | lisp/js/lisp.js | 3 | ||||
-rw-r--r-- | lisp/js/repl.js | 1 |
4 files changed, 41 insertions, 4 deletions
diff --git a/lisp/js/README.md b/lisp/js/README.md index 9feae22..92f2fa9 100644 --- a/lisp/js/README.md +++ b/lisp/js/README.md @@ -1,7 +1,31 @@ # a little lisp +Most of this lifed from <https://github.com/maryrosecook/littlelisp>, <https://maryrosecook.com/blog/post/little-lisp-interpreter>. + To run interactively: ```bash node repl.js +``` + +To run in the browser: + +```html +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>lisp</title> + <script src="lisp.js" type="text/javascript"></script> +</head> +<body> + <script> + const ret = lisp.interpret(lisp.parse( + `(print + (add 3 3))` + )); + </script> +</body> +</html> ``` \ No newline at end of file diff --git a/lisp/js/l.html b/lisp/js/l.html new file mode 100644 index 0000000..2ab4e13 --- /dev/null +++ b/lisp/js/l.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>lisp</title> + <script src="lisp.js" type="text/javascript"></script> +</head> +<body> + <script> + const ret = lisp.interpret(lisp.parse( + `(print + (add 3 3))` + )); + </script> +</body> +</html> \ No newline at end of file diff --git a/lisp/js/lisp.js b/lisp/js/lisp.js index c686e59..1bb3e0b 100644 --- a/lisp/js/lisp.js +++ b/lisp/js/lisp.js @@ -1,6 +1,3 @@ -// lifted from https://github.com/maryrosecook/littlelisp -// extended by eli - (function (exports) { const library = { print: (x) => { diff --git a/lisp/js/repl.js b/lisp/js/repl.js index 6ea6929..08bbfd5 100644 --- a/lisp/js/repl.js +++ b/lisp/js/repl.js @@ -1,4 +1,3 @@ -// lifted from https://github.com/maryrosecook/littlelisp var repl = require("repl"); var lisp = require("./lisp").lisp; |