{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T07:49:33Z","timestamp":1790927373178,"version":"4.1.0"},"reference-count":62,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA2","license":[{"start":{"date-parts":[[2022,10,31]],"date-time":"2022-10-31T00:00:00Z","timestamp":1667174400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2022,10,31]]},"abstract":"<jats:p>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.<\/jats:p>\n          <jats:p>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 ExT. The DSL is highly flexible and extensible, allowing users to create various non-trivial extensions easily. For instance, ExT supports various extensions that enable the production of wiki-like documents, LaTeX documents, vector graphics or charts. The viability of compositional embeddings for ExT is evaluated with three applications.<\/jats:p>","DOI":"10.1145\/3563294","type":"journal-article","created":{"date-parts":[[2022,10,31]],"date-time":"2022-10-31T20:23:35Z","timestamp":1667247815000},"page":"175-203","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":3,"title":["Compositional embeddings of domain-specific languages"],"prefix":"10.1145","volume":"6","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-7011-2441","authenticated-orcid":false,"given":"Yaozhu","family":"Sun","sequence":"first","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-3187-3563","authenticated-orcid":false,"given":"Utkarsh","family":"Dhandhania","sequence":"additional","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1846-7210","authenticated-orcid":false,"given":"Bruno C. d. S.","family":"Oliveira","sequence":"additional","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2022,10,31]]},"reference":[{"key":"e_1_2_2_1_1","unstructured":"Dean Allen. 2002. Textile Markup Language Documentation. https:\/\/textile-lang.com \t\t\t\t  Dean Allen. 2002. Textile Markup Language Documentation. https:\/\/textile-lang.com"},{"key":"e_1_2_2_2_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-37521-7"},{"key":"e_1_2_2_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/3428297"},{"key":"e_1_2_2_4_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2018.9"},{"key":"e_1_2_2_5_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2018.22"},{"key":"e_1_2_2_6_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-17184-1_14"},{"key":"e_1_2_2_7_1","unstructured":"Richard Boulton Andrew Gordon Mike Gordon John Harrison John Herbert and John Van Tassel. 1992. Experience with Embedding Hardware Description Languages in HOL. In TPCD. \t\t\t\t  Richard Boulton Andrew Gordon Mike Gordon John Harrison John Herbert and John Van Tassel. 1992. Experience with Embedding Hardware Description Languages in HOL. In TPCD."},{"key":"e_1_2_2_8_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796809007205"},{"key":"e_1_2_2_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/351240.351266"},{"key":"e_1_2_2_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/1119479.1119483"},{"key":"e_1_2_2_11_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796813000270"},{"key":"e_1_2_2_12_1","unstructured":"Sven Efftinge and Markus V\u00f6lter. 2006. oAW xText: A Framework for Textual DSLs. \t\t\t\t  Sven Efftinge and Markus V\u00f6lter. 2006. oAW xText: A Framework for Textual DSLs."},{"key":"e_1_2_2_13_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-73589-2_14"},{"key":"e_1_2_2_14_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.cl.2015.08.007"},{"key":"e_1_2_2_15_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45337-7_17"},{"key":"e_1_2_2_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/1111037.1111062"},{"key":"e_1_2_2_17_1","doi-asserted-by":"crossref","unstructured":"Matthew Flatt and Eli Barzilay. 2009. Low-Level Scribble API: Structures And Processing. https:\/\/docs.racket-lang.org\/scribble\/core.html \t\t\t\t  Matthew Flatt and Eli Barzilay. 2009. Low-Level Scribble API: Structures And Processing. https:\/\/docs.racket-lang.org\/scribble\/core.html","DOI":"10.1145\/1631687.1596569"},{"key":"e_1_2_2_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/1596550.1596569"},{"key":"e_1_2_2_19_1","unstructured":"Martin Fowler. 2005. A Language Workbench in Action - MPS. https:\/\/martinfowler.com\/articles\/mpsAgree.html \t\t\t\t  Martin Fowler. 2005. A Language Workbench in Action - MPS. https:\/\/martinfowler.com\/articles\/mpsAgree.html"},{"key":"e_1_2_2_20_1","volume-title":"Language Workbenches: The Killer-App for Domain Specific Languages? https:\/\/martinfowler.com\/articles\/languageWorkbench.html","author":"Fowler Martin","year":"2005","unstructured":"Martin Fowler . 2005 . Language Workbenches: The Killer-App for Domain Specific Languages? https:\/\/martinfowler.com\/articles\/languageWorkbench.html Martin Fowler. 2005. Language Workbenches: The Killer-App for Domain Specific Languages? https:\/\/martinfowler.com\/articles\/languageWorkbench.html"},{"key":"e_1_2_2_21_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796805005575"},{"key":"e_1_2_2_22_1","volume-title":"Design Patterns: Elements of Reusable Object-Oriented Software","author":"Gamma Erich","year":"1995","unstructured":"Erich Gamma , Richard Helm , Ralph Johnson , and John Vlissides . 1995 . Design Patterns: Elements of Reusable Object-Oriented Software . Addison-Wesley Professional . Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. 1995. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Professional."},{"key":"e_1_2_2_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/2628136.2628138"},{"key":"e_1_2_2_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/1596638.1596653"},{"key":"e_1_2_2_25_1","unstructured":"David Goodger. 2002. reStructuredText: Markup Syntax and Parser Component of Docutils. https:\/\/docutils.sourceforge.io\/rst.html \t\t\t\t  David Goodger. 2002. reStructuredText: Markup Syntax and Parser Component of Docutils. https:\/\/docutils.sourceforge.io\/rst.html"},{"key":"e_1_2_2_26_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-32505-3_20"},{"key":"e_1_2_2_27_1","doi-asserted-by":"publisher","DOI":"10.29007\/xlbn"},{"key":"e_1_2_2_28_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796806006022"},{"key":"e_1_2_2_29_1","doi-asserted-by":"publisher","DOI":"10.1145\/1868294.1868307"},{"key":"e_1_2_2_30_1","doi-asserted-by":"publisher","DOI":"10.1145\/1449913.1449935"},{"key":"e_1_2_2_31_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSR.1998.685738"},{"key":"e_1_2_2_32_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-59451-5_3"},{"key":"e_1_2_2_33_1","doi-asserted-by":"publisher","DOI":"10.1145\/2658761.2658771"},{"key":"e_1_2_2_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/1869459.1869497"},{"key":"e_1_2_2_35_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-32202-0_3"},{"key":"e_1_2_2_36_1","doi-asserted-by":"publisher","DOI":"10.4204\/EPTCS.66.11"},{"key":"e_1_2_2_37_1","doi-asserted-by":"publisher","DOI":"10.1007\/S10009-010-0142-1"},{"key":"e_1_2_2_38_1","unstructured":"Shriram Krishnamurthi. 2001. Linguistic Reuse. Ph. D. Dissertation. Rice University. \t\t\t\t  Shriram Krishnamurthi. 2001. Linguistic Reuse. Ph. D. Dissertation. Rice University."},{"key":"e_1_2_2_39_1","volume-title":"Parsec: Direct Style Monadic Parser Combinators for the Real World.","author":"Leijen Daan","year":"2001","unstructured":"Daan Leijen and Erik Meijer . 2001 . Parsec: Direct Style Monadic Parser Combinators for the Real World. Daan Leijen and Erik Meijer. 2001. Parsec: Direct Style Monadic Parser Combinators for the Real World."},{"key":"e_1_2_2_40_1","unstructured":"John MacFarlane. 2014. CommonMark Spec. https:\/\/spec.commonmark.org \t\t\t\t  John MacFarlane. 2014. CommonMark Spec. https:\/\/spec.commonmark.org"},{"key":"e_1_2_2_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/74877.74919"},{"key":"e_1_2_2_42_1","unstructured":"MediaWiki. 2003. Wikitext. https:\/\/www.mediawiki.org\/wiki\/Wikitext \t\t\t\t  MediaWiki. 2003. Wikitext. https:\/\/www.mediawiki.org\/wiki\/Wikitext"},{"key":"e_1_2_2_43_1","unstructured":"MediaWiki. 2011. Parsoid. https:\/\/www.mediawiki.org\/wiki\/Parsoid \t\t\t\t  MediaWiki. 2011. Parsoid. https:\/\/www.mediawiki.org\/wiki\/Parsoid"},{"key":"e_1_2_2_44_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-03013-0_13"},{"key":"e_1_2_2_45_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-31057-7_2"},{"key":"e_1_2_2_46_1","volume-title":"Ralf Hinze, and Andres L\u00f6h.","author":"Bruno","year":"2006","unstructured":"Bruno C. d. S. Oliveira , Ralf Hinze, and Andres L\u00f6h. 2006 . Extensible and Modular Generics for the Masses. In TFP. Bruno C. d. S. Oliveira, Ralf Hinze, and Andres L\u00f6h. 2006. Extensible and Modular Generics for the Masses. In TFP."},{"key":"e_1_2_2_47_1","doi-asserted-by":"publisher","DOI":"10.1145\/2426890.2426909"},{"key":"e_1_2_2_48_1","doi-asserted-by":"publisher","DOI":"10.1145\/2951913.2951945"},{"key":"e_1_2_2_49_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-39038-8_2"},{"key":"e_1_2_2_50_1","doi-asserted-by":"publisher","DOI":"10.1145\/1160074.1159811"},{"key":"e_1_2_2_51_1","doi-asserted-by":"publisher","DOI":"10.1007\/S10990-013-9096-9"},{"key":"e_1_2_2_52_1","doi-asserted-by":"publisher","DOI":"10.1145\/1868294.1868314"},{"key":"e_1_2_2_53_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-662-44202-9_16"},{"key":"e_1_2_2_54_1","doi-asserted-by":"publisher","DOI":"10.1145\/581690.581691"},{"key":"e_1_2_2_55_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.cl.2015.07.003"},{"key":"e_1_2_2_56_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796808006758"},{"key":"e_1_2_2_57_1","unstructured":"Philip Wadler. 1998. The Expression Problem. Posted on the Java Genericity mailing list. https:\/\/homepages.inf.ed.ac.uk\/wadler\/papers\/expression\/expression.txt \t\t\t\t  Philip Wadler. 1998. The Expression Problem. Posted on the Java Genericity mailing list. https:\/\/homepages.inf.ed.ac.uk\/wadler\/papers\/expression\/expression.txt"},{"key":"e_1_2_2_58_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-1-349-91518-7_11"},{"key":"e_1_2_2_59_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2017.29"},{"key":"e_1_2_2_60_1","doi-asserted-by":"publisher","DOI":"10.22152\/programming-journal.org\/2019\/3\/10"},{"key":"e_1_2_2_61_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2020.102449"},{"key":"e_1_2_2_62_1","doi-asserted-by":"publisher","DOI":"10.1145\/3460228"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3563294","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3563294","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T16:38:10Z","timestamp":1750178290000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3563294"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2022,10,31]]},"references-count":62,"journal-issue":{"issue":"OOPSLA2","published-print":{"date-parts":[[2022,10,31]]}},"alternative-id":["10.1145\/3563294"],"URL":"https:\/\/doi.org\/10.1145\/3563294","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2022,10,31]]},"assertion":[{"value":"2022-10-31","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}