A Formal Way from Text to Code Templates

Guido Wachsmuth. A Formal Way from Text to Code Templates. In Marsha Chechik, Martin Wirsing, editors, Fundamental Approaches to Software Engineering, 12th International Conference, FASE 2009, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009, York, UK, March 22-29, 2009. Proceedings. Volume 5503 of Lecture Notes in Computer Science, pages 109-123, Springer, 2009. [doi]


We present an approach to define template languages for generating syntactically correct code. In the first part of the paper, we define the syntax and semantics of a template language for text generation. We use Natural Semantics for expressing both the static and the dynamic semantics of the language. In the second part, we deal with template languages for code generation in a particular target language. We provide construction steps for the syntax and semantics of such languages. The approach is generic and can be applied to any target language.