import continuation
import environment
import parse
import kernel_type as kt

def run_one_expr(val, env):
    cont = continuation.TerminalContinuation()
    try:
        while True:
            val, env, cont = val.interpret(env, cont)
    except continuation.Done as e:
        return e.value


if __name__ == '__main__':
    expr, = parse.parse('"test"').exprs
    result = run_one_expr(expr, environment.empty_environment())
    assert isinstance(result, kt.String)
    assert result.value == 'test'
    print "All OK."

@@ -1,12 +1,42 @@
+from rpython.rlib import jit%0A%0A
 import conti
@@ -205,16 +205,80 @@
 e True:%0A
+            driver.jit_merge_point(val=val, env=env, cont=cont)%0A
         
@@ -382,16 +382,311 @@
 .value%0A%0A
+def get_printable_location(green_val):%0A    if green_val is None:%0A        return %22No green val%22%0A    else:%0A        return green_val.tostring()%0Adriver = jit.JitDriver(reds=%5B'env', 'cont'%5D,%0A                       greens=%5B'val'%5D,%0A                       get_printable_location=get_printable_location)%0A
 %0Aif __na

enable JIT