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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.