Samenvatting
A code generator is a program translating an input model into code. In this paper we focus on template-based code generators in the context of the model view controller architecture (MVC). The language in which the code generator is written is known as a metalanguage in the code generation parlance. The metalanguage should be, on the one side, expressive enough to be of practical value, and, on the other side, restricted enough to enforce the separation between the view and the model, according to the MVC. In this paper we advocate the notion of unparser-complete metalanguages as providing the right level of expressivity. An unparsercomplete metalanguage is capable of expressing an unparser, a code generator that translates any legal abstract syntax tree into an equivalent sentence of the corresponding context-free language. A metalanguage not able to express an unparser will fail to produce all sentences belonging to the corresponding context-free language. A metalanguage able to express more than an unparser will also be able to implement code violating the model/view separation. We further show that a metalanguage with the power of a linear deterministic tree-to-string transducer is unparser-complete. Moreover, this metalanguage has been successfully applied in a nontrivial case study where an existing code generator is refactored using templates.
Originele taal-2 | Engels |
---|---|
Titel | GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering |
Plaats van productie | New York NY |
Uitgeverij | Association for Computing Machinery, Inc |
Pagina's | 137-146 |
Aantal pagina's | 10 |
ISBN van geprinte versie | 978-1-4503-0689-8 |
DOI's | |
Status | Gepubliceerd - 23 nov. 2011 |
Evenement | 10th ACM International Conference on Generative Programming and Component Engineering (GPCE 2011) - Portland, Verenigde Staten van Amerika Duur: 22 okt. 2011 → 23 okt. 2011 Congresnummer: 10 |
Publicatie series
Naam | ACM Sigplan Notices |
---|---|
Volume | 47(3) |
ISSN van geprinte versie | 0362-1340 |
Congres
Congres | 10th ACM International Conference on Generative Programming and Component Engineering (GPCE 2011) |
---|---|
Verkorte titel | GPCE 2011 |
Land/Regio | Verenigde Staten van Amerika |
Stad | Portland |
Periode | 22/10/11 → 23/10/11 |