[antlr-interest] The Classic else (Non-)Ambiguity

Scott Stanchfield scott at javadude.com
Tue May 4 09:25:49 PDT 2010


>>  It's far too easy to make mistakes when writing rules;
>> grammars are not easy!
>
> That's true. And it's made even harder by tools that claim the problem
> is they couldn't choose between A and B, where B would produce a
> broken result that is completely illegal (not a matter of taste or
> choice, but a complete failure to recognize the specified language)

I think "specified language" is the key here. What I specify and what
I mean are often two different things, especially in early
development. The more a tool can help me with "did you really mean
that", the better.

I've gotta say you have an interesting argument here, but I always get
afeared of the "slippery slope" and "trickle-down" effects. After
this, what would be the next "only reasonable way" that we move into
the tool? It makes the tool less general-purpose, and could end up
having some unintended consequences.

Of course there is another option: you can create your own parser
generator that does this. If this feature and others prove more
helpful and easier to understand, natural selection should take its
course...

I prefer to have tools be a wee-bit less clever so I don't need to
understand their cleverness to use them, though it's a fine line to
find...

-- Scott

----------------------------------------
Scott Stanchfield
http://javadude.com


More information about the antlr-interest mailing list