[antlr-interest] How to use one tree grammar to generate C# and Java?

Fridi fridi70 at gmx.de
Thu Sep 4 04:19:24 PDT 2008


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?

Thanks in advance,
  fridi


More information about the antlr-interest mailing list