[antlr-interest] inline code for multiple target languages

Marco Trudel marco at mtsystems.ch
Tue Aug 25 04:26:16 PDT 2009


Hello all

I have a grammar that I use for C and Java. Is there a way to have
inline code for both languages? Something like:

options {
    language = C; // or Java
}

scope Symbols {
    antlr_if language == "Java" then
       Set types;
    else
       pANTLR3_HASH_TABLE types;
    end
}

Or is there something that allows me to do something similar? Currently
I manually comment/uncomment the code when I change the language.


Thanks
Marco



More information about the antlr-interest mailing list