The pattern matching translator. Its general structure is a pipeline:
Match tree ---matchPlan---> Plan ---optimize---> Plan ---emit---> Tree
The pipeline consists of three steps:
- build a plan, using methods
- optimize the plan, using methods listed in
- emit the translated tree, using methods
A plan represents the underlying decision graph. It consists of tests, let bindings, labeled blocks, return from said labeled blocks and code blocks. It's represented by its own data type. Plans are optimized by merging common tests and eliminating dead code.
Minimal number of cases to emit a switch