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

Creative Commons Attribution 4.0 License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS
 
 

To view the content in your browser, please download Adobe Reader or, alternately,
you may Download the file to your hard drive.

NOTE: The latest versions of Adobe Reader do not support viewing PDF files within Firefox on Mac OS and if you are using a modern (Intel) Mac, there is no official plugin for viewing PDF files within the browser window.