diff options
-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); }, }); |