def main(): arg = sys.argv[1] processtime_in_ms = time.time() * 1000 with open(arg) as fs: # Generate Tokens lexer = Lexer(fs.read()) tokens = lexer.generate_tokens() # Generate AST parser = Parser(tokens) ast = parser.parse() # Global conductor instance conductor = Conductor() # Interpret AST interpreter = Interpreter(ast, conductor) interpreter.interpret() print(f"\nPROCESS TIME: {time.time() * 1000 - processtime_in_ms}ms")
from interpreter.lexer import Lexer from interpreter.parser_ import Parser while True: text = input("statement > ") lexer = Lexer(text) tokens = lexer.generate_tokens() parser = Parser(tokens) tree = parser.parse() print(tree)