Compiling Match Statements to Bytecode
Summary
The article presents a practical compiler pipeline for Purple Garden, detailing how match statements are parsed, typechecked, lowered to an SSA-based IR, and finally emitted as bytecode for a custom VM. It covers the overall architecture, with examples like factorial, and discusses optimisations such as removing useless blocks and future tail-call optimisations. The piece blends Rust code snippets with high-level design notes to illustrate end-to-end code generation.