diff options
author | elioat <hi@eli.li> | 2023-03-03 10:51:14 -0500 |
---|---|---|
committer | elioat <hi@eli.li> | 2023-03-03 10:51:14 -0500 |
commit | 948473e7899cfdfb30b62b608a04d94041d2c727 (patch) | |
tree | 8fcd8d4fbf449f025e6d80650a696d0e30e66963 | |
parent | 23f5e09b399db722a245b603e9c09b5e8bd2e301 (diff) | |
download | tour-948473e7899cfdfb30b62b608a04d94041d2c727.tar.gz |
*
-rw-r--r-- | lisp/js/l.html | 4 | ||||
-rw-r--r-- | lisp/js/lisp.js | 5 | ||||
-rw-r--r-- | lisp/js/repl.js | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/lisp/js/l.html b/lisp/js/l.html index 2ab4e13..2699c4e 100644 --- a/lisp/js/l.html +++ b/lisp/js/l.html @@ -8,10 +8,10 @@ </head> <body> <script> - const ret = lisp.interpret(lisp.parse( + const ret = lisp.run( `(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 1bb3e0b..06e18e5 100644 --- a/lisp/js/lisp.js +++ b/lisp/js/lisp.js @@ -414,8 +414,13 @@ return parenthesize(tokenize(input)); }; + let run = function (input) { + return interpret(parse(input)) + }; + exports.lisp = { parse: parse, interpret: interpret, + run: run, }; })(typeof exports === "undefined" ? this : exports); diff --git a/lisp/js/repl.js b/lisp/js/repl.js index 08bbfd5..61f67c3 100644 --- a/lisp/js/repl.js +++ b/lisp/js/repl.js @@ -4,7 +4,7 @@ var lisp = require("./lisp").lisp; repl.start({ prompt: "* ", eval: function (cmd, context, filename, callback) { - var ret = lisp.interpret(lisp.parse(cmd)); + var ret = lisp.run(cmd); callback(null, ret); }, }); |