@@ -44,6 +44,7 @@ def import_module(kind: str, name: str, env: dict, here_file: str) -> str:
4444NATIVE_GLOBALS = {
4545 "__builtins__" : {
4646 "print" : builtins .print ,
47+ "input" : builtins .input ,
4748 "len" : builtins .len ,
4849 "range" : builtins .range ,
4950 "abs" : builtins .abs ,
@@ -63,11 +64,11 @@ def evaluate(ast, env=None):
6364 env = {}
6465
6566 KW = [
66- "*" , "/" , "-" , "+" , "let" , "print" , "scan" , " if" , "elif" , "else" , "while" ,
67+ "*" , "/" , "-" , "+" , "let" , "if" , "elif" , "else" , "while" ,
6768 "list" , "append" , "index" , ">" , "<" , ">=" , "<=" , "==" , "!=" ,
6869 "true" , "false" , "&" , "|" , "sqrt" , "pow" , "mod" , "abs" ,
6970 "len" , "reverse" , "concat" , "strlen" , "substr" ,
70- "fn" , "call" , "native" , "use"
71+ "fn" , "call" , "native" , "use" , "return"
7172 ]
7273
7374 E = lambda x : evaluate (x , env )
@@ -98,6 +99,8 @@ def evaluate(ast, env=None):
9899 if token == "&" : return bool (E (ast [idx + 1 ]) and E (ast [idx + 2 ]))
99100 if token == "|" : return bool (E (ast [idx + 1 ]) or E (ast [idx + 2 ]))
100101
102+ if token == "return" : return E (ast [idx + 1 ])
103+
101104 # --- Variables ---
102105 if token == "let" :
103106 name = ast [idx + 1 ]
@@ -156,6 +159,7 @@ def evaluate(ast, env=None):
156159 return s [start :end ]
157160
158161 # --- I/O ---
162+ """
159163 if token == "print":
160164 value = E(ast[idx + 1])
161165 print(value)
@@ -164,6 +168,7 @@ def evaluate(ast, env=None):
164168 if token == "scan":
165169 prompt = E(ast[idx + 1])
166170 return input(prompt)
171+ """
167172
168173 # --- Control Flow ---
169174 if token == "if" :
0 commit comments