Skip to content
PhilippeSigaud edited this page Mar 18, 2012 · 15 revisions

Generating Code

Once a grammar is defined and a parse tree generated, how can it be used? We already saw how to use the parse tree in Using the Parse Tree, at runtime or compile-time. But since Pegged can parse at compile-time, the information can also be used to generate a string containing D code, which can in turn be mixed in standard D code.

This is exactly what Pegged itself does with the input you give it.

(to be continued)


Next lesson: User-Defined Parsers


Pegged Tutorial

Clone this wiki locally