M. Grebe, D. Young, and A. Gill, “Rewriting a shallow dsl using a ghc compiler extension,” 2017, submitted to the 16th International Conference on Generative Programming: Concepts & Experience.



Embedded Domain Specific Languages are a powerful tool for developing customized languages to fit specific problem domains.
Shallow EDSLs allow a programmer to program using many of the features of a host language and its syntax, but sacrifice performance. Deep EDSLs provide better performance and flexibility, through the ability to manipulate the abstract syntax tree of the DSL program, but sacrifice syntactical similarity to the host language. Using Haskino, an EDSL designed for small embedded systems based on the Arduino line of microcontrollers, and a compiler plugin for the Haskell GHC compiler, we show a method for combining the best aspects of shallow and deep EDSLs. The programmer is able to write in the shallow EDSL, and have it automatically transformed into the deep EDSL. This allows the EDSL user to benefit from powerful aspects of the host language, Haskell, while meeting the demanding resource constraints of the small embedded processing environment.


  author = {Mark Grebe and David Young and Andy Gill},
  title = {Rewriting a shallow DSL using a GHC compiler extension},
  note = {Submitted to the 16th International Conference on Generative Programming: Concepts & Experience},
  year = {2017},