Abstract

A common approach to defining 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 seminar, we show that the 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. We also illustrate an instance of compositional embeddings with a DSL for document authoring called ExT.