Fast and Extensible Hybrid Embeddings with Micros

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Bocirnea, Sean, Bowman, William J.
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916942493777920
author Bocirnea, Sean
Bowman, William J.
author_facet Bocirnea, Sean
Bowman, William J.
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2509_07551
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Fast and Extensible Hybrid Embeddings with Micros
Bocirnea, Sean
Bowman, William J.
Programming Languages
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.
title Fast and Extensible Hybrid Embeddings with Micros
topic Programming Languages
url https://arxiv.org/abs/2509.07551