On Sep 4, 2008, at 4:19 AM, Fridi wrote:

> Hi all,
>
> i have a build a tree parser with ANTLR and the C# sources are
> generated. At runtime, the generated sources do the evaluation.
> Of course by setting the language option I can generate Java as well.
> But in my rules, I have to change all data types, imports / usings and
> included sources.
> I could copy the tree grammar and make one for C#, and the other for
> Java, but that means maintaining 2 grammars.
> Is there a way - maybe using stringtemplate - to use 1 grammar that
> either emits C# or Java code?

Sure. ANTLR itself Does that...you have a StringTemplateGroup pointer  
that refers to one of two groups.  ANTLR's -> foo(...) notation loads  
template foo from the appropriate group. no fuss no muss.
Ter

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---

Reply via email to