Re: preprocessing an ANTLR grammar

I've been able to use the GNU C preprocessor for a Pascal compiler in the past.
As you imply, the difficulty is in turning OFF all the C-specific stuff:
You can use -D and -U to set/unset variables
You should use:
-nostdinc         suppress looking for std libs
-P                    inhibit c-specific line-number tracking lines from output
-C                    do not discard comments
I haven't done this in a long while.  Here's the reference:
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Preprocessor-Options.html#Preprocessor-Options

>>>>> I need to generate C and Java from an ANTLR grammar containing
>>>>> actions. Is there a preprocessor approach I can use rather than
>>>>> maintaining two versions of the grammar?

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to