Enhanced repl. Use global var and emit() function to process stmts.