diff --git a/interp.py b/interp.py index 31ff90b..38f447e 100644 --- a/interp.py +++ b/interp.py @@ -69,3 +69,10 @@ else: print("Unknown command %s" % (ast)) return None + +def run_ast(ast): + env = { + "System": system_module, + } + for command in ast: + run_command(env, command) diff --git a/main.py b/main.py index 98c776d..3a06c06 100755 --- a/main.py +++ b/main.py @@ -14,11 +14,7 @@ ast = parse.parse_file(args[1]) if not ast: return 1 - env = { - "System": interp.system_module, - } - for command in ast: - interp.run_command(env, command) + interp.run_ast(ast) return 0 if __name__ == "__main__":