Everything old is new again: Quoted Domain Specific Languages

Everything old is new again: Quoted Domain Specific Languages, by Shayan Najd, Sam Lindley, Josef Svenningsson, Philip Wadler:

We describe a new approach to domain specific languages (DSLs), called Quoted DSLs (QDSLs), that resurrects two old ideas: quotation,
from McCarthy’s Lisp of 1960, and the subformula property, from Gentzen’s natural deduction of 1935. Quoted terms allow the DSL to share the syntax and type system of the host language. Normalising quoted terms ensures the subformula property, which guarantees that one can use higher-order types in the source while guaranteeing first-order types in the target, and enables using types to guide fusion. We test our ideas by re-implementing Feldspar, which was originally implemented as an Embedded DSL (EDSL), as a QDSL; and we compare the QDSL and EDSL variants.

Neat paper first posted here by Blaisorblade that formalizes the properties needed for using quotation to implement DSLs. Most embedded DSLs use custom operators and lifted conditionals to make embedded programs seem more natural, but quoting enables the use of native operators and conditions, and might lead to more natural expressions of lightweight (possibly heterogenous) staged computations.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

ignorant questions

The paper is exciting at first blush to me. Then reading along, it talks about generating C -- but it seems to be a limited subset of C. How is memory allocation handled? How would interfacing with other C libs work? Etc, etc, etc.

The compilation to C is one

The compilation to C is one of the embedded DSLs they discuss (Feldspar for digital signal processing).

yes but

Sorry I didn't explain myself well, and/or I am even more dense than even I realized. I did read & skim the paper. My curiosity was piqued when they said they generate C. But then I was disappointed that more nitty gritty details seemed to not be explained or referenced: e.g. searching for "memory" did not turn up a discussion of how it is managed.

The Feldspar link I provide

The Feldspar link I provide above hosts the papers for that language. Pretty sure that's where you'll find your answers.


Thanks. I tried to look at those. Though skimming things it doesn't (at least yet) make sense to me since I thought the paper here was reimplementing Feldspar with a new approach to DSLs so it didn't seem like whatever Feldspar did vis-a-vie C issues matters; I want to know what the new framework does for any DSL implemented in it.

Jaśkowski's natural deduction more important than Gentzen’s

Jaśkowski's natural deduction is much more important than Gentzen’s

Please see the following:
* Inconsistency Robustness in Logic Programs
* Formalizing common sense