Code Generation with Templates

J. Arnoldus, M. Brand, Alexander Serebrenik, J. Brunekreef
{"title":"Code Generation with Templates","authors":"J. Arnoldus, M. Brand, Alexander Serebrenik, J. Brunekreef","doi":"10.2991/978-94-91216-56-5","DOIUrl":null,"url":null,"abstract":"Templates are used to generate all kinds of text, including computer code. The last decade, the use of templates gained a lot of popularity due to the increase of dynamic web applications. Templates are a tool for programmers, and implementations of template engines are most times based on practical experience rather than based on a theoretical background. This book reveals the mathematical background of templates and shows interesting findings for improving the practical use of templates. First, a framework to determine the necessary computational power for the template metalanguage is presented. The template metalanguage does not need to be Turing-complete to be useful. A non-Turing-complete metalanguage enforces separation of concerns between the view and model. Second, syntactical correctness of all languages of the templates and generated code is ensured. This includes the syntactical correctness of the template metalanguage and the output language. Third, case studies show that the achieved goals are applicable in practice. It is even shown that syntactical correctness helps to prevent cross-site scripting attacks in web applications. The target audience of this book is twofold. The first group exists of researcher interested in the mathematical background of templates. The second group exists of users of templates. This includes designers of template engines on one side and programmers and web designers using templates on the other side","PeriodicalId":248639,"journal":{"name":"Atlantis Studies in Computing","volume":"26 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-05-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"11","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Atlantis Studies in Computing","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.2991/978-94-91216-56-5","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 11

Abstract

Templates are used to generate all kinds of text, including computer code. The last decade, the use of templates gained a lot of popularity due to the increase of dynamic web applications. Templates are a tool for programmers, and implementations of template engines are most times based on practical experience rather than based on a theoretical background. This book reveals the mathematical background of templates and shows interesting findings for improving the practical use of templates. First, a framework to determine the necessary computational power for the template metalanguage is presented. The template metalanguage does not need to be Turing-complete to be useful. A non-Turing-complete metalanguage enforces separation of concerns between the view and model. Second, syntactical correctness of all languages of the templates and generated code is ensured. This includes the syntactical correctness of the template metalanguage and the output language. Third, case studies show that the achieved goals are applicable in practice. It is even shown that syntactical correctness helps to prevent cross-site scripting attacks in web applications. The target audience of this book is twofold. The first group exists of researcher interested in the mathematical background of templates. The second group exists of users of templates. This includes designers of template engines on one side and programmers and web designers using templates on the other side
使用模板生成代码
模板用于生成各种文本,包括计算机代码。在过去十年中,由于动态web应用程序的增加,模板的使用得到了广泛的普及。模板是程序员的工具,模板引擎的实现大多是基于实践经验,而不是基于理论背景。这本书揭示了模板的数学背景,并为改进模板的实际使用显示了有趣的发现。首先,给出了一个确定模板元语言所需计算能力的框架。模板元语言并不需要图灵完备才有用。非图灵完备元语言强制分离视图和模型之间的关注点。其次,确保模板和生成代码的所有语言的语法正确性。这包括模板元语言和输出语言的语法正确性。第三,案例分析表明,所达成的目标在实践中具有一定的适用性。它甚至表明,语法正确性有助于防止web应用程序中的跨站点脚本攻击。这本书的目标读者是双重的。第一类是对模板的数学背景感兴趣的研究者。第二组是模板用户。这包括一边是模板引擎的设计者,另一边是使用模板的程序员和网页设计者
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信