Interpreters
intermediateYour evaluator does one thing: it takes an expression and computes a value. But what if you wanted the same expression to do something else entirely — like print itself as a string?
The expression 2 + (3 * 4) could mean “compute 14” or it could mean “produce the string (2 + (3 * 4))”. Same structure, different meaning.
This problem separates expressions from their interpretation. You will build expression trees as tagged pairs, then write multiple interpreters for the same tree — using everything you have built so far: pairs, closures, recursion, and conditionals.
Yes, you are writing an interpreter inside the interpreter you just built. Try not to think about it too hard.