Interpreter

Interpreter: evaluate sentences in a tiny language

Problem: you have a small grammar β€” rules, formulas, filters β€” and want to evaluate expressions written in it.

Be honest: full Interpreter is rare in app code. Most 'tiny languages' are better served by data + a fold, or a real parser gem. But the idea is worth knowing.

PawWalk scenario: a minimal price-adjustment rule: a list of ["add", n] / ["sub", n] tokens applied to a starting total.