Exemplo n.º 1
0
 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) + ")"
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
Arquivo: rt.py Projeto: halgari/cljvm
 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)
Exemplo n.º 4
0
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