Compositional embeddings of domain-specific languages
Yaozhu Sun, Utkarsh Dhandhania, Bruno C. d. S. Oliveira
摘要
A common approach to defining domain-specific languages (DSLs) is via a direct embedding into a host language. There are several well-known techniques to do such embeddings, including shallow and deep embeddings. However, such embeddings come with various trade-offs in existing programming languages. Owing to such trade-offs, many embedded DSLs end up using a mix of approaches in practice, requiring a substantial amount of code, as well as some advanced coding techniques.
In this paper, we show that the recently proposed Compositional Programming paradigm and the CP language provide improved support for embedded DSLs. In CP we obtain a new form of embedding, which we call a compositional embedding, that has most of the advantages of both shallow and deep embeddings. On the one hand, compositional embeddings enable various forms of linguistic reuse that are characteristic of shallow embeddings, including the ability to reuse host-language optimizations in the DSL and add new DSL constructs easily. On the other hand, similarly to deep embeddings, compositional embeddings support definitions by pattern matching or dynamic dispatching (including dependent interpretations, transformations, and optimizations) over the abstract syntax of the DSL and have the ability to add new interpretations. We illustrate an instance of compositional embeddings with a DSL for document authoring called E X T. The DSL is highly flexible and extensible, allowing users to create various non-trivial extensions easily. For instance, E X T supports various extensions that enable the production of wiki-like documents, L A T E X documents, vector graphics or charts. The viability of compositional embeddings for E X T is evaluated with three applications.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
它引用的顶会 Paper1
相关 Paper
- A Core Calculus for Documents: Or, Lambda: The Ultimate DocumentWill Crichton, Shriram KrishnamurthiPOPL 2024 · 被引用 4 次
- MimIR: An Extensible and Type-Safe Intermediate Representation for the DSL AgeRoland Leißa, Marcel Ullrich, Joachim Meyer, Sebastian HackPOPL 2025 · 被引用 1 次
- Fluent APIs in Functional LanguagesOri Roth, Yossi GilOOPSLA 2023 · 被引用 3 次
- Imperative Compositional Programming: Type Sound Distributive Intersection Subtyping with References via Bidirectional TypingWenjia Ye, Yaozhu Sun, Bruno C. d. S. OliveiraOOPSLA 2024 · 被引用 1 次
- How Domain Experts Use an Embedded DSLLisa Rennels, Sarah E. ChasinsOOPSLA 2023 · 被引用 4 次
