Date of Award
2025
Degree Type
Thesis
Degree Name
Master of Science in Computer Science
Department
Computer Science and Statistics
First Advisor
Lutz Hamel
Abstract
This thesis presents the design, implementation, and evaluation of a compiler for Asteroid, a multi-paradigm programming language that introduces first-class pattern matching as a core feature. Unlike conventional pattern matching systems - typically restricted to syntactic constructs like match or case expressions - Asteroid elevates patterns to first-class entities, enabling them to be assigned to variables, passed as arguments, returned from functions, and composed dynamically.
To support this novel abstraction, the compiler is structured as a two-phase system: a Python-based frontend for parsing and syntax analysis, and a Rust-based backend that compiles the language into executable code via a custom virtual machine (AVM). Key challenges addressed include runtime representation of patterns, efficient decision tree construction for matching, and seamless integration with traditional control flow constructs.
Performance was evaluated using a series of benchmark programs including recursive functions, numerical simulations, and symbolic pattern-based computations, with compiled programs achieving up to 45× speedups over the interpreted version. The resulting performance curves exhibit consistent asymptotic divergence, where compiled runtimes follow predictable polynomial or near-linear growth trends, while interpreted execution grows exponentially in many cases. These curves clearly illustrate how the compiler eliminates interpretation overhead and decision-tree traversal costs, producing measurable performance separations that validate the efficiency of the compiled pattern-matching model.
These results demonstrate that first-class patterns can offer both expressive power and practical performance, providing a viable path forward for programming languages that seek to unify data and control abstractions in a more flexible and reusable way.
Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 License.
Recommended Citation
Colaneri, Timothy, "DESIGN AND EVALUATION OF A COMPILER ARCHITECTURE FOR FIRST-CLASS PATTERN MATCHING" (2025). Open Access Master's Theses. Paper 2680.
https://digitalcommons.uri.edu/theses/2680