Up Next
With the conclusion of this example, we have the skills necessary to build all sorts of generators. The primary lesson is that generators consist of a collection of templates and some code to traverse the model. The traversal code trawls for data, creates and combines templates, injects them with attributes, and builds up a template tree. Sometimes the input model traversal code is responsible for the entire template hierarchy, sometimes the templates do all the work, and sometimes they share this responsibility. In the end, we call toString on the template tree root to generate text.
We’re nearing the end of our adventure. We’ve learned a lot about language implementation by exploring and applying the common language design patterns. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access