Abstract
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.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
The Eclipse Foundation: Java Emitter Templates (JET) (2008), http://www.eclipse.org/modeling/emf/
The Eclipse Foundation: Eclipse Modeling Framework (EMF) (2007), http://www.eclipse.org/modeling/emf/
OpenArchitectureWare: XPand (2008), http://www.openarchitectureware.org
The Eclipse Foundation: Eclipse Graphical Modeling Framework (GMF) (2008), http://www.eclipse.org/gmf/
Object Management Group: MOF Model to Text Transformation Language, version 1.0 (January 2008)
Parr, T.J.: A functional language for generating structured text. Draft (2006)
Parr, T.J., Quong, R.W.: Antlr: a predicated-ll(k) parser generator. Softw. Pract. Exper. 25(7), 789–810 (1995)
Parr, T.J.: Intelligent web site page generation (2007)
Lämmel, R.: Grammar adaptation. In: Oliveira, J.N., Zave, P. (eds.) FME 2001. LNCS, vol. 2021, pp. 550–570. Springer, Heidelberg (2001)
Kahn, G.: Natural semantics. In: Brandenburg, F.J., Wirsing, M., Vidal-Naquet, G. (eds.) STACS 1987. LNCS, vol. 247, pp. 22–39. Springer, Heidelberg (1987)
Lämmel, R., Wachsmuth, G.: Transformation of SDF syntax definitions in the ASF+SDF Meta-Environment. ENTCS 44(2) (2001)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)
Parr, T.J.: Enforcing strict model-view separation in template engines. In: Feldman, S.I., Uretsky, M., Najork, M., Wills, C.E. (eds.) WWW 2004, pp. 224–233. ACM, New York (2004)
van den Brand, M., Heering, J., de Jong, H., de Jonge, M., Kuipers, T., Klint, P., Moonen, L., Olivier, P., Scheerder, J., Vinju, J., Visser, E., Visser, J.: The ASF+SDF Meta-Environment: a Component-Based Language Development Environment. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, p. 365. Springer, Heidelberg (2001)
Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/xt 0.16: components for transformation systems. In: Hatcliff, J., Tip, F. (eds.) PEPM 2006, pp. 95–99. ACM, New York (2006)
Hemel, Z., Kats, L.C.L., Visser, E.: Code generation by model transformation. In: Vallecillo, A., Gray, J., Pierantonio, A. (eds.) ICMT 2008. LNCS, vol. 5063, pp. 183–198. Springer, Heidelberg (2008)
Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 299–315. Springer, Heidelberg (2002)
Bravenboer, M., Dolstra, E., Visser, E.: Preventing injection attacks with syntax embeddings. In: Consel, C., Lawall, J.L. (eds.) GPCE 2007, pp. 3–12. ACM, New York (2007)
Gao, J., Heimdahl, M., Van Wyk, E.: Flexible and extensible notations for modeling languages. In: Dwyer, M.B., Lopes, A. (eds.) FASE 2007. LNCS, vol. 4422, pp. 102–116. Springer, Heidelberg (2007)
Van Wyk, E., Krishnan, L., Schwerdfeger, A., Bodin, D.: Attribute grammar-based language extensions for java. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 575–599. Springer, Heidelberg (2007)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wachsmuth, G. (2009). A Formal Way from Text to Code Templates. In: Chechik, M., Wirsing, M. (eds) Fundamental Approaches to Software Engineering. FASE 2009. Lecture Notes in Computer Science, vol 5503. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-00593-0_8
Download citation
DOI: https://doi.org/10.1007/978-3-642-00593-0_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-00592-3
Online ISBN: 978-3-642-00593-0
eBook Packages: Computer ScienceComputer Science (R0)