source-academy / source-programs

Notable Source programs, developed for SICP JS and other educational projects
GNU General Public License v3.0
7 stars 18 forks source link

Non-Det MCE: make final program result accessible #9

Closed arsalan0c closed 4 years ago

arsalan0c commented 4 years ago

Currently, the evaluator simply prints the final result of the program.
eg. "// Amb-Eval value:" 3

With this PR, the final result is kept track of in a global variable (final_result) thereby allowing it to be accessible after running parse_and_run. The final result is also returned upon invoking parse_and_run and try_again. These simplify the writing of test programs.