[antlr-interest] action syntax proposal for v3

Sebastian Mies sebastian.mies at gmx.net
Sun Nov 6 04:09:42 PST 2005


Hi Martin,

>> I think adding some conditional generation would be nice too.
>> Something like:
>> 
>> @define(niceexceptions)
>> @if(niceexceptions) {
>>     @rule.exception { }
>> }

MP> Do I smell the C pre-processor and his macros-of-doom? I would be very
MP> careful to enable a macro-ish language aspect.
Well, actually this is no macro at all.

MP> I would vote to rather provide specific options like this as runtime
MP> flags, e.g. "Parser.setContinueAfterErrors(true)". You really don't need
MP> a full blown macro compile-time language to provide such a small feature.
I did not suggest a full-blown macro engine. Its just a way to generate
different versions of one grammar - when a runtime solution is not
suitable. And I admit, that it IS a small feature.

>> It would also give the grammars a slight aspect-oriented touch.

MP> Everytime I ask someone for an example for the use of Aspect Oriented
MP> Programming the only thing they can come up with is logging...
Well, the alternative is having lots of macros.
And BTW: there are many cases where aspect-oriented programming can be
helpful - considering synchronized versions of datastructures,
creating primitive versions...
Just consider ArrayList in java: if you want an IntArrayList you would
have to write one by copy, paste, and replace - that could be solved
with a nice aspect or you have to use a transformation tool, like
inject/j ;-)

Sebastian.





More information about the antlr-interest mailing list