Templates and friends
Course "Software Language Engineering"
University of Koblenz-Landau Department of Computer Science Ralf Lämmel Software Languages Team
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 1 What’s a template?
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 2 “Hello World” with StringTemplate in Java
String template with one parameter import org.stringtemplate.v4.*; ... ST hello = new ST("Hello,
[http://www.antlr.org/wiki/display/ST4/Introduction, 10 December 2012]
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 3 “Hello World” with StringTemplate in C#
using Antlr4.StringTemplate;
Template hello = new Template("Hello,
[http://www.antlr.org/wiki/display/ST4/Introduction, 10 December 2012]
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 4 “Hello World” with StringTemplate in Python
import stringtemplate4 hello = stringtemplate4.ST("Hello,
[http://www.antlr.org/wiki/display/ST4/Introduction, 10 December 2012]
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 5 Quick summary
Exercised concepts A template is a declarative, Literal text parametrized, and executable Place holder for text description of a text generator. Other concepts Conditionals, loops over template “context” Expression holes for computing output ... Find a proper definition that fits into the context of this lecture.
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 6 Motivation: templates in web development
© 2012 Ralf Lämmel, Software Language Engineering http://softlang.wikidot.com/course:sle 7 Web programming with PHP