Chapter 52. Transformer Generation

Generate code by writing a transformer that navigates the input model and produces output.

image

52.1 How It Works

Transformer Generation involves writing a program that takes the Semantic Model as input and produces an output in the form of source code for the target environment. I like to think of transformers in terms of input-driven and output-driven sections. Output-driven transformation starts from the required output and dives into the input to gather the data it needs as it goes. Input-driven transformation walks the input data structure and produces output.

For an example, consider generating a web page ...

Get Domain Specific Languages 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.