diff options
| author | mryouse | 2022-07-08 23:59:01 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-08 23:59:01 +0000 |
| commit | a96a94ede913b87f6e5e7bba79591750268c95e9 (patch) | |
| tree | 83197288524e71d36a0e684432e4be10114afde8 /neb/std/repl.py | |
| parent | 0a646ac3dacafd7c266a34fb9dcab40e6e9649c1 (diff) | |
implement parse-neb
Diffstat (limited to 'neb/std/repl.py')
| -rw-r--r-- | neb/std/repl.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/neb/std/repl.py b/neb/std/repl.py index ccd48bd..b888d1a 100644 --- a/neb/std/repl.py +++ b/neb/std/repl.py @@ -1,4 +1,5 @@ -from .. import TypeEnum, Environment, Arg, Builtin, UserFunction, Function, evaluate, InterpretPanic, Callable, Macro +from .. import TypeEnum, Environment, Arg, Builtin, UserFunction, Function, evaluate, InterpretPanic, Callable, Macro, lex, parse +from .core import interpretQuote from ..structs import * REPL = Environment() @@ -34,3 +35,8 @@ def interpretMacros(symbol, args, env, ns): return List(keys) REPL.register("macros", Builtin("macros", interpretMacros, [], return_type=Type(":list"))) + +def interpretParseNeb(symbol, args, env, ns): + return interpretQuote(None, [parse(lex(args[0].value))[0]], env, ns) + +REPL.register("parse-neb", Builtin("parse-neb", interpretParseNeb, [Arg("string", TypeEnum.STRING)], return_type=Type(":any"))) |
