def repr(self): from system.helpers import first, next s = self a = [] while s is not None: if first(s) is None: a.append("nil") else: a.append(first(s).repr()) s = next(s) return "(" + " ".join(a) + ")"
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 invoke_args(self, args_w): from system.helpers import first, next globals, frame, can_tail_call, name, s = args_w[:5] body = args_w[5:][0] args = [] while s is not None: args.append(first(s)) s = next(s) return FuncInstance(globals, name ,args, body)
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