[antlr-interest] generating multiple files from a single input file
Gavin Lambert
antlr at mirality.co.nz
Mon Oct 13 13:11:36 PDT 2008
At 07:49 14/10/2008, Tom Smith wrote:
>Right now I have a multipass translator to generate code based
on
>a program written in a DSL (using StringTemplate rewrites). I
just
>realized that I have enough information in my AST to generate
some
>other supporting files as well. Is there a straightforward way
to
>structure this task?
Probably the simplest way to do it would be to just create
multiple tree walkers that you run in turn, each one creating one
of the outputs.
Otherwise you could use a single tree walker and write multiple
sets of output to different streams. I'm not sure if this is
compatible with use of StringTemplate, though.
I thought there was an example somewhere demonstrating writing out
.c files together with .h files, but I can't find it at the moment.
More information about the antlr-interest
mailing list