Chapter 12Generating DSLs with Templates

Unlike the other chapters in this book, this chapter doesn’t have any patterns. Instead, we’re going to learn by example. We’re at the point where we need to look at some bigger problems and start applying the patterns we’ve learned. In this chapter, we’re going to build a number of template-driven generators to demonstrate the model-driven strategy from the previous chapter. We’ll see how language patterns apply to some interesting problems. The implementations are up to you, but I’ll get you started by laying out the basic application architectures.

We’re going to use a template engine called StringTemplate[51] (ST) throughout this chapter. There are lots of other template engines (such as Velocity, ...

Get Language Implementation Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.