Fast and Extensible Hybrid Embeddings with Micros

📅 2025-09-09
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Shallow embedding of macros in host languages like Scheme suffers from poor compile-time performance and limited extensibility. This paper proposes a hybrid embedding approach based on *micros*: source-language syntax is first translated into an intermediate representation (IR) via micros, thereby combining the semantic rigor of deep embedding with the expressive flexibility of shallow embedding. The IR design adopts scalable patterns and abstraction encapsulation mechanisms, enabling dynamic extension of both the IR and its associated operations. To our knowledge, this is the first approach to achieve both high compilation performance and strong language extensibility in static-type-language compilation. Experimental evaluation on the Racket platform demonstrates that our method significantly outperforms conventional macro-based embedding in compilation speed while preserving excellent language extensibility.

Technology Category

Application Category

📝 Abstract
Macro embedding is a popular approach to defining extensible shallow embeddings of object languages in Scheme like host languages. While macro embedding has even been shown to enable implementing extensible typed languages in systems like Racket, it comes at a cost: compile-time performance. In this paper, we revisit micros - syntax to intermediate representation (IR) transformers, rather than source syntax to source syntax transformers (macros). Micro embedding enables stopping at an IR, producing a deep embedding and enabling high performance compile-time functions over an efficient IR, before shallowly embedding the IR back into source syntax. Combining micros with several design patterns to enable the IR and functions over it to be extensible, we achieve extensible hybrid embedding of statically typed languages with significantly improved compile-time compared to macro-embedding approaches. We describe our design patterns and propose new abstractions packaging these patterns.
Problem

Research questions and friction points this paper is trying to address.

Improving compile-time performance of extensible language embeddings
Enabling extensible hybrid embeddings with micros
Combining micros with design patterns for extensibility
Innovation

Methods, ideas, or system contributions that make the work stand out.

Micros transform syntax to intermediate representation
Extensible hybrid embedding with improved compile-time
Design patterns enable extensible IR and functions
🔎 Similar Papers
No similar papers found.
S
Sean Bocirnea
University of British Columbia, Vancouver, Canada
William J. Bowman
William J. Bowman
University of British Columbia
Computer ScienceProgramming Languages