Пример #1
0
 def invoke(self, args, ctx):
     from parser import parse
     from compiler import emit
     w_str = space.cast(args[0], space.W_String)
     f = open(w_str.val)
     try:
         input = f.read()
         parsed = parse(input)
         for sexp in parsed:
             code = emit(ctx, eval.read(ctx, sexp))
             ctx.run(code)
     finally:
         f.close()
Пример #2
0
def entry_point(argv):
    if len(argv) == 1:
        filename = "repl.clj"
    else:
        filename = argv[1]
    f = open(filename)
    input = f.read()
    f.close()
    parsed = parser.parse(input)
    ctx = eval.Context()
    for sexp in parsed:
        code = compiler.emit(ctx, eval.read(ctx, sexp))
        ctx.run(code)
    return 0
Пример #3
0
 def invoke(self, args, ctx):
     from compiler import emit
     w_form = args[0]
     code = emit(ctx, w_form)
     value = ctx.run(code)
     return value