A simple debugger for a simple evaluator

Hi,

I wrote a small gist about using open recursion and fix to instrument an expression evaluator.

Nothing earth-shattering, but helped me understand the open recursion technique better.

*Main> :main
current expression: Add (Mul (Val 2) (Val 3)) (Add (Val 5) (Add (Val 11) (Val 13)))
what to do? give value, step over, step return, or <ENTER> to step into:

current expression: Mul (Val 2) (Val 3)
what to do? give value, step over, step return, or <ENTER> to step into:

current expression: Val 2
what to do? give value, step over, step return, or <ENTER> to step into:

current expression: Val 3
5 Likes

That’s nice! Short enough for a quick read but still explains the problem & solution very well, I like it!