[antlr-interest] Bug report: Unexplainable "no viable alternative"

Gerald Rosenberg gerald at certiv.net
Wed Nov 4 07:05:59 PST 2009


At 05:06 AM 11/4/2009, you wrote:
>Hello Jim, Gerald
>
>@ Jim: I suppose you are referring to the much larger grammar I've
>mentioned in the initial post by "myriad syntactic predicates". However,
>this is why I extracted this (quite simple) example, which has a single
>syntactic predicate and yet fails to perform the recognition. On the other
>hand, the  rule associative_dimension_1 *is* left-factored, and re-writing
>it using a syntactic predicate (as associative_dimension_2) made the
>grammar work in the first place.
>Indeed, choosing k=1 fixes the problem, but I still don't understand if
>this change is reliable as a global change in the "much larger grammar".
>
>@ Gerald: At the moment I'm trying to install AntlrDT in order to reproduce
>the diagrams and better understand what exactly is the difference between
>rules associative_dimension_1 and _2. It seems that eclipse has loaded the
>plugin, but I don't find any new perspective/view/editor.

The diagrams show the exact path taken by the parser.  When live, you 
can click through the diagrams to the parser/lexer rules and input 
text, so it makes understanding a bit easier.

As for installation, did you install the requirements?

http://www.certiv.net/projects/antlrdt.html#requirements

Tip:  when installing, turn off "Group items by category" -- makes 
finding the dependencies easier.

Restart with "-clean"

Verify the install by checking Help->About->Installation details->Plugins

Check in Help->About->Installation details->Configuration for 
problems with the run-time initialization of the plugin.

If in doubt, send me a copy off-list.


>However, I don't see why the recognition would treat differently the two
>subrules which I find equivalent (i.e. why doesn't the parser follow
>sized_or_unsized_dimension when using _1).

That k=1 is suspect.  It looks like it is also restricting the 
predicate lookahead.  If you cannot remove it, then Jim's comments 
apply even stronger.



More information about the antlr-interest mailing list