diff --git a/src/deuthon/interpreter.py b/src/deuthon/interpreter.py index 4b285ec..873b3c2 100644 --- a/src/deuthon/interpreter.py +++ b/src/deuthon/interpreter.py @@ -1,11 +1,19 @@ from .transformer import parse_german_code +import traceback + def interpreter(): while True: try: - german_code = input('>>> ') + german_code = input(">>> ") except EOFError: break - python_code = parse_german_code(german_code) - exec(python_code) \ No newline at end of file + try: + python_code = parse_german_code(german_code) + result = eval(python_code, globals()) + + if result is not None: + print(result) + except Exception: + print(traceback.format_exc())