[antlr-interest] generating multiple files from a single input file

Tom Smith yotommy at gmail.com
Tue Oct 14 06:26:52 PDT 2008


Gavin, thanks for the idea.

In addition to Gavin's suggestion, I guess it is possible to have a single tree
walker that uses different StringTemplate groups to form the output.  Does
anyone have thoughts on the workability of these approaches?

Thanks,
Tom.

On Mon, Oct 13, 2008 at 4:11 PM, Gavin Lambert <antlr at mirality.co.nz> wrote:
> 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