Less is more: Unparser-completeness of metalanguages for template engines

Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

2 Citations (Scopus)
1 Downloads (Pure)

Abstract

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.

Original languageEnglish
Title of host publicationGPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering
Place of PublicationNew York NY
PublisherAssociation for Computing Machinery, Inc
Pages137-146
Number of pages10
ISBN (Print)978-1-4503-0689-8
DOIs
Publication statusPublished - 23 Nov 2011
Event10th ACM International Conference on Generative Programming and Component Engineering (GPCE 2011) - Portland, United States
Duration: 22 Oct 201123 Oct 2011
Conference number: 10

Publication series

NameACM Sigplan Notices
Volume47(3)
ISSN (Print)0362-1340

Conference

Conference10th ACM International Conference on Generative Programming and Component Engineering (GPCE 2011)
Abbreviated titleGPCE 2011
CountryUnited States
CityPortland
Period22/10/1123/10/11

Fingerprint

Engines
Context free languages
Controllers
Transducers

Keywords

  • Code generation
  • Templates
  • Unparser

Cite this

Arnoldus, B. J., Van Den Brand, M. G. J., & Serebrenik, A. (2011). Less is more: Unparser-completeness of metalanguages for template engines. In GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering (pp. 137-146). (ACM Sigplan Notices; Vol. 47(3)). New York NY: Association for Computing Machinery, Inc. https://doi.org/10.1145/2189751.2047887
Arnoldus, B.J. ; Van Den Brand, M.G.J. ; Serebrenik, A. / Less is more : Unparser-completeness of metalanguages for template engines. GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering. New York NY : Association for Computing Machinery, Inc, 2011. pp. 137-146 (ACM Sigplan Notices).
@inproceedings{4918f149e55c4c78857fa3af2ea15d4c,
title = "Less is more: Unparser-completeness of metalanguages for template engines",
abstract = "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.",
keywords = "Code generation, Templates, Unparser",
author = "B.J. Arnoldus and {Van Den Brand}, M.G.J. and A. Serebrenik",
year = "2011",
month = "11",
day = "23",
doi = "10.1145/2189751.2047887",
language = "English",
isbn = "978-1-4503-0689-8",
series = "ACM Sigplan Notices",
publisher = "Association for Computing Machinery, Inc",
pages = "137--146",
booktitle = "GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering",
address = "United States",

}

Arnoldus, BJ, Van Den Brand, MGJ & Serebrenik, A 2011, Less is more: Unparser-completeness of metalanguages for template engines. in GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering. ACM Sigplan Notices, vol. 47(3), Association for Computing Machinery, Inc, New York NY, pp. 137-146, 10th ACM International Conference on Generative Programming and Component Engineering (GPCE 2011), Portland, United States, 22/10/11. https://doi.org/10.1145/2189751.2047887

Less is more : Unparser-completeness of metalanguages for template engines. / Arnoldus, B.J.; Van Den Brand, M.G.J.; Serebrenik, A.

GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering. New York NY : Association for Computing Machinery, Inc, 2011. p. 137-146 (ACM Sigplan Notices; Vol. 47(3)).

Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

TY - GEN

T1 - Less is more

T2 - Unparser-completeness of metalanguages for template engines

AU - Arnoldus, B.J.

AU - Van Den Brand, M.G.J.

AU - Serebrenik, A.

PY - 2011/11/23

Y1 - 2011/11/23

N2 - 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.

AB - 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.

KW - Code generation

KW - Templates

KW - Unparser

UR - http://www.scopus.com/inward/record.url?scp=81455135804&partnerID=8YFLogxK

U2 - 10.1145/2189751.2047887

DO - 10.1145/2189751.2047887

M3 - Conference contribution

SN - 978-1-4503-0689-8

T3 - ACM Sigplan Notices

SP - 137

EP - 146

BT - GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering

PB - Association for Computing Machinery, Inc

CY - New York NY

ER -

Arnoldus BJ, Van Den Brand MGJ, Serebrenik A. Less is more: Unparser-completeness of metalanguages for template engines. In GPCE'11 - Proceedings of the 10th International Conference on Generative Programming and Component Engineering. New York NY: Association for Computing Machinery, Inc. 2011. p. 137-146. (ACM Sigplan Notices). https://doi.org/10.1145/2189751.2047887