def workspace_run(text): code = parser.parse_code(text) if isinstance(code.expr, terp.Constant) and code.expr.value is None: # Special case to add variables to the workspace. I know, yuck. for var in code.locals: workspace_env.enter(var, None) block = terp.Block(text, workspace_env, code) # XXX redundant with hiss.run() return terp.trampoline(block.enter((), terp.final_k))
def run(text, env): block = parse_block(text, env) return terp.trampoline(block.enter((), terp.final_k))