def _test_eval(input: str) -> object.Object: l = lexer.Lexer(input) p = parser.Parser(l) program = p.parse_program() env = object.Environment() return evaluator.eval(program, env)
def start(): env = object.Environment() while True: line = input(prompt) l = Lexer(line) p = Parser(l) program = p.parse_program() val = evaluator.eval(program, env) print(val)
def start(): env = object.Environment() while True: line = input(PROMPT) if not line: return l = lexer.Lexer(line) p = parser.Parser(l) program = p.parse_program() if len(p.errors) != 0: print_parse_errors(p.errors) continue evaluated = evaluator.eval(program, env) if evaluated is not None: print(evaluated.inspect())
def _eval(self, input: str) -> objmod.Object: psr = parser.Parser(lexer.Lexer(input)) program = psr.parse() env = objmod.Environment() return evaluator.eval(program, env)
def eval_test(input): l = lexer.Lexer(input) p = parser.Parser(l) program = p.parse_program() return evaluator.eval(program, object.Environment())