Code Generation From ADomain Specific Language

Stratego -- Strategies for Program Transformation
Jonne van Wijngaarden, Code Generation from a Domain Specific Language. Designing and Implementing Complex Program Transformations MSc Thesis INF/SCR-03-29, Institute of Information and Computing Sciences, Utrecht University. July 8, 2003. (pdf)


From the early nineties onwards, generating code from a domain specific language (DSL) is considered by many a panacea for solving the infamous software crisis, because it has the potential to allow for a reduction in development time, make program code less complex, and decrease the learning curve for developing software. Although the development of a language and related components such as parsers and prettyprinters has been well understood for quite some time now, the actual transformation of a DSL to target source code (usually a high level general purpose programming language like C, Java or Haskell) proved difficult mainly because of the lack of powerful program transformation tools. Recent developments in this area however again put DSLs in the spotlight. In this paper we describe the results of a study on implementing a DSL compiler using the modern program transformation tool Stratego. Although Stratego and comparable tools have been used for implementing a wide variety of program transformations, this study shows that the design and implementation of the complex program transformations needed in our DSL compiler still is difficult for a number of reasons for which we present solutions in this paper. These problems include the lack of theory to describe and design program transformations and the lack of a suitable syntax for implementing certain transformations.