Skip to Main Content
Language Implementation Patterns
book

Language Implementation Patterns

by Terence Parr
December 2009
Intermediate to advanced content levelIntermediate to advanced
380 pages
9h 2m
English
Pragmatic Bookshelf
Content preview from Language Implementation Patterns

Building Retargetable Translators

If we can easily make a translator generate different output, we say that it’s retargetable. As we mentioned in Using a Tree Grammar to Create Templates, altering or swapping in new templates is one way to do this. The template hierarchy stays the same, just the contents of those templates change. This retargeting approach is really useful if you need to generate different SQL to suit different database vendors, for example. (Alas, we often do.)

In this section, we’re going to learn another retargeting strategy that changes the output language by changing the template hierarchy. The interesting thing is that we assemble different hierarchies using the templates themselves, not using Java code. As before, all ...

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.
Start your free trial

You might also like

Implementation Patterns

Implementation Patterns

Kent Beck

Publisher Resources

ISBN: 9781680500097Errata Page