def run_file(file): from system.reader import read_from_file f = read_from_file(file) from system.evaluation import eval from system.helpers import first return eval(first(f)).int()
def main(filename): import system.reader as reader from system.evaluation import eval from system.helpers import first, next s = reader.read_from_file(filename) while s is not None: res = eval(first(s)) print res s = next(s) return 0
def repl(): from system.reader import read_from_string from system.evaluation import eval while True: cnt = 0 txt = "" while True: ri = raw_input("=>") for x in range(len(ri)): if ri[x] in "[({": cnt += 1 if ri[x] in "])}": cnt -= 1 txt += ri if cnt == 0: break if txt == "die": break rd = read_from_string(txt) print eval(rd).repr()
def run_benchmark(times): c = list.invoke_args([symbol(None, "+"), integer(2), integer(3)]) return eval(c).int()
def test_add(self): lst = rt.list.invoke_args([symbol(None, "+"), integer(1), integer(2)]) result = eval(lst) assertEqual(self, result, integer(3))
def test_int(self): result = eval(integer(1)) assertEqual(self, result, integer(1))