On Fri, Oct 28, 2011 at 1:50 AM, Voelkel, Andy <[email protected] > wrote:
> Hi, > > I have a project where I have to produce multiple output files (C source > files) from a single AST. It seems clear at this point that using > StringTemplate to produce the output files makes the most sense. So how do I > get multiple StringTemplate "streams" from a single AST? I can think two > ways: > > > 1. Write separate tree grammars to produce the separate outputs, > using built-in ANTLR-to-StringTemplate integration. > > 2. Write one tree grammar, and use helper functions to build the > separate outputs using manual creation of StringTemplates. > > 3. Or is there another way? > > Approach #1 has the advantage of being able to use the built in integration > between ANTLR and StringTemplate. But the disadvantage is that if I change > the AST structure, I have to change all the tree grammar files, rerun the > code generation, etc. Right now I'm leaning towards the helper functions > which construct StringTemplates manually. Does anyone have any advice? I'm > assuming that I can't use ANTLR-StringTemplate integration and also produce > multiple StringTemplates with a single tree grammar. Do I have this right? > > > - Andy > Hi Andy, Take a look at the cminus example in http://www.antlr.org/download/examples-v3.tar.gz. Cminus demonstrates String Templates by emitting source code for Python, Java, and Bytecode. Hope that helps, Eric > > ________________________________ > > CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files > or previous e-mail messages attached to it, may contain information that is > confidential and/or legally privileged. If you are not the intended > recipient, or a person responsible for delivering it to the intended > recipient, please DO NOT disclose the contents to another person, store or > copy the information in any medium, or use any of the information contained > in or attached to this transmission for any purpose. If you have received > this transmission in error, please immediately notify the sender by reply > email or at [email protected], and destroy the original transmission > and its attachments without reading or saving in any manner. > > For further information about Plantronics - the Company, its products, > brands, partners, please visit our website www.plantronics.com. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
