Lune

OOPSLA2022顶会

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.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

可以从这些问题问起

Lune 可以查阅

全文 · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

它引用的引用它的从左到右按年份排列,引用越多,位置越高。

它引用的 Paper1

  1. Macros for domain-specific languagesMichael Ballantyne, Alexis King, Matthias FelleisenOOPSLA 2020 · 17 次引用

相关 Paper

  1. A Core Calculus for Documents: Or, Lambda: The Ultimate DocumentWill Crichton, Shriram KrishnamurthiPOPL 2024 · 4 次引用
  2. MimIR: An Extensible and Type-Safe Intermediate Representation for the DSL AgeRoland Leißa, Marcel Ullrich, Joachim Meyer, Sebastian HackPOPL 2025 · 1 次引用
  3. Fluent APIs in Functional LanguagesOri Roth, Yossi GilOOPSLA 2023 · 3 次引用
  4. Imperative Compositional Programming: Type Sound Distributive Intersection Subtyping with References via Bidirectional TypingWenjia Ye, Yaozhu Sun, Bruno C. d. S. OliveiraOOPSLA 2024 · 1 次引用
  5. How Domain Experts Use an Embedded DSLLisa Rennels, Sarah E. ChasinsOOPSLA 2023 · 4 次引用
黄昏的海面,两侧是细线勾勒的悬崖