Heh, now I can run a REPL
This commit is contained in:
parent
deb0f5820b
commit
c88ab1f787
@ -15,6 +15,10 @@ def _add_native_methods(mod):
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def _read(*args):
|
||||
return sys.stdin.readline()
|
||||
|
||||
|
||||
def _lex(*args):
|
||||
ret = []
|
||||
for thing in args:
|
||||
@ -124,7 +128,8 @@ def _add_native_methods(mod):
|
||||
"<=": _le,
|
||||
"!=": _ne,
|
||||
"eval": _eval,
|
||||
"lex": _lex
|
||||
"lex": _lex,
|
||||
"read": _read,
|
||||
}
|
||||
|
||||
for native in natives:
|
||||
|
@ -9,6 +9,14 @@ def _define(obj, lns):
|
||||
obj.namespace[args[0]] = args[1]()
|
||||
|
||||
|
||||
def _loop(obj, lns):
|
||||
fd = obj.get_invocation()
|
||||
args = fd['args']
|
||||
while True:
|
||||
for arg in args:
|
||||
arg.eval(lns.clone())
|
||||
|
||||
|
||||
def _fn(obj, lns):
|
||||
fd = obj.get_invocation()
|
||||
args = fd['args']
|
||||
@ -62,4 +70,5 @@ builtins = {
|
||||
"import": _import,
|
||||
"kwapply": _kwapply,
|
||||
"if": _if,
|
||||
"loop": _loop
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user