[antlr-interest] Re: Suggestion: syntactic sugar for generateAmbigWarnings = false;

uprightness_of_character andrei at metalanguage.com
Wed Jun 18 13:16:53 PDT 2003


I (predictably) concur. In my projects with antlr (a C-like language 
translator, a Cecil documentation system, and an email filter) I found 
myself quite often needing to express precedence between rules with 
overlapping FIRST sets. The generated code is also more efficient 
than, for example, making sure the FIRST sets are non-overlapping by 
using ~(THIS | THAT | THE_OTHER). 

Using "options { generateAmbigWarnings = false; } : ..." works fine, 
but it adds clutter to the code. In a rule with multiple alternatives, 
the option might hide ambiguities that you *would* care to know about. 
If you want precision, the parentheses that you need to insert would 
add yet some more clutter to the code and render the grammar less 
readable.

This all makes for a pretty decent case for adding "||" as an 
alternative separator imho.


Andrei

--- In antlr-interest at yahoogroups.com, "antlrlist" <antlrlist at y...> 
wrote:
> 
> In the ANTLR Options documentation page 
> (http://www.antlr.org/doc/options.html#_bb15), you can see the 
> following warning:
> 
> [Warning: you should know what you are doing before you use this 
> option.  I deliberately made it a pain to shut warnings off (rather 
> than a single character operator) so you would not just start 
turning 
> off all the warnings.  I thought for long time before implementing 
> this exact mechanism.  I recommend a comment in front of any use of 
> this option that explains why it is ok to hush the warning.] 
> 
> Right, this warning concerns the WarnWhenFollowAmbig option. But I 
> think this may be applicable to generateAmbigWarnings as well.
> 
> What do you think?
> 
> Enrique
> 
> 
> --- In antlr-interest at yahoogroups.com, "uprightness_of_character" 
> <andrei at m...> wrote:
[snip]


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list