diff options
Diffstat (limited to 'neb.py')
| -rw-r--r-- | neb.py | 42 |
1 files changed, 4 insertions, 38 deletions
@@ -1,7 +1,6 @@ from lexer import lex from parser import parse -from runner import evaluate -from std import _get_debug +from interpreter import interpret import sys @@ -15,44 +14,11 @@ def main(): data = fil.read() try: - lexed = lex(data, []) - ''' - if _get_debug(): - acc = " ".join([f"{l}" for l in lexed]) - print(f" - LEX: {acc}") - ''' - parsed = parse(lexed, []) - ''' - if _get_debug(): - acc = " ".join([f"{p}" for p in parsed]) - print(f" - PARSE: {acc}") - ''' - ev = evaluate(parsed, []) + lexed = lex(data) + parsed = parse(lexed) + ev = interpret(parsed) except Exception as e: print(f"panic! {e}") - ''' - print("### neb :)(:") - print("version: < 0") - idx = 1 - while True: - inp = input(f"#{idx}> ") - if len(inp.strip()) == 0: - continue - try: - lexed = lex(inp, []) - if _get_debug(): - acc = " ".join([f"{l}" for l in lexed]) - print(f" - LEX: {acc}") - parsed = parse(lexed, []) - if _get_debug(): - acc = " ".join([f"{p}" for p in parsed]) - print(f" - PARSE: {acc}") - ev = evaluate(parsed, []) - print(f"=> {ev}") - idx += 1 - except Exception as e: - print(f"panic! {e}") - ''' if __name__ == "__main__": |
