Notes on
Domain-Specific Languages:
Chapter Index
H. Conrad Cunningham
27 April 2022
Browser Advisory: The HTML version of this textbook requires a browser that supports the display of MathML. A good choice as of April 2022 is a recent version of Firefox from Mozilla.
The chapter Introduction to DSLs [3] motivates and defines the general domain-specific language concepts and techniques.
Fowler’s Reader DSLs include both external and internal Ruby-based DSLS adapted from Fowler [4,5].
The State Machine (Secret Panel) DSLs are Scala-based external DSLs adapted from Fowler [7].
The Computer Configuration DSLs are Scala-based internal DSLs adapted from Fowler [7].
The Email Message Building DSL is a Scala-based internal DSL adapted from Fowler [7].
The Lair Configuration DSLs are mostly internal DSLS adapted from Fowler [6]. One is an external DSL. All are in Lua; some are also in Python.
The Survey DSL is a Ruby-based internal DSL that I developed in my research [2]. Thee idea was partly motivated by a sidebar in Bentley [1].
I developed the Haskell-based Sandwich DSL as scaffolding for a programming project in a Haskell-based course. It is now included as a section in Chapter 21 of Exploring Languages with Interpreters and Functional Programming.
I subsequently developed the similar Scala-based Sandwich DSL for the same purpose in a Scala-based class.
I developed the Haskell-based Exam DSL as scaffolding for a programming project in a Haskell-based course. It is now included as a section in Chapter 21 of Exploring Languages with Interpreters and Functional Programming.
During the 2013-18 period, I partially developed three different sets of interpreters. I developed the first in Lua in 2013 (KILT), but I was not satsisfied with the modularization and some of the structures I used. So I rewrote it in Lua in 2016 for the CSci 450 class. Actual use of the Lua interpreter for class was difficult, partly because of the dyanmic typing of Lua. So I began a third set using the statically typed Haskell language, which also had good algebraic data types and pattern matching.
Fall 2017-18 ELI Calculator language interpreter includes the following source code modules:
PrefixCalcREPL
InfixCalcREPL
ParsePrefixCalc
ParseInfixCalc
LexCalc
AbSynCalc
EvalCalc
Environments
Values
Process AST
Fall 2017-18 ELI ImpCore interpreter modules (prefix syntax) code mostly works but needs a bit of update to match recent changes to ELI Calculator:
See the Acknowledgements section for the “Introduction to DSLs” chapter for information about the overall development of this set of notes. See the corresponding sections of the DSL chapters for information about each DSL case study.
I retired from the full-time faculty in May 2019. As one of my post-retirement projects, I am continuing work on possible textbooks based on the course materials I had developed during my three decades as a faculty member. In January 2022, I began refining the existing content, integrating separately developed materials together, reformatting the documents, constructing a unified bibliography (e.g., using citeproc), and improving my build workflow and use of Pandoc.
I maintain this chapter as text in Pandoc’s dialect of Markdown using embedded LaTeX markup for the mathematical formulas and then translate the document to HTML, PDF, and other forms as needed.