Rewriting code with continuations
问题 I have some code that evaluates primitive programs. Program is a list of statements (expression, block, return statement). Result of evaluation is last evaluated expression. Also evaluator should properly treat return statement (i.e. stop evaluation after first occurrence of return ). To implement this logic I pass special callback function ( NextStep ) which make next evaluating step after current statement. I don't call next step when handling return statement: data Statement = Expr Int |