| Essay 49 | Generating Code at Its Core |
Taking the leap into code generation is an important pilgrimage every developer ought to take. It frees us to think about code as a powerful tool to transform how we work, not just as merely the material we use to write programs.
So, how do we actually write a generator? For a truly in-depth source, I highly recommend Jack Herrington’s outstanding book, Code Generation in Action [Her03]. It covers detailed techniques and high-level patterns for generating code of all kinds. But we don’t need that level of detail to get started. Here are the essentials.
Define Your Input Source
First, create an input source. It’s the place that houses all the parameters our code generator needs to do its work. The input ...
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