[antlr-interest] Problems with NoViableAltException on compile

John B. Brodie jbb at acm.org
Sun Mar 11 09:40:03 PDT 2012


Greetings!

On 03/11/2012 12:34 PM, Dave Brosius wrote:
> Greetings, i had a working antlr 3.4 grammer that i am trying to
> embellish, and am getting the exception below.
>
> The grammer in question is kind of big so i pastebin'ed it here:
> http://pastebin.com/CVhFCCtB
>
> The addition in question is just an alternative choice on line 614 of
>
>       |   PIXELAVERAGE '(' expr, ',' expr ',' expr ')'
--------------------------------------^??
looks like an extra comma here
>           {
>               mv.visitInsn(Opcodes.POP);                     //don't mind
> this impl, it's just stubbed for now
>               mv.visitInsn(Opcodes.POP);
>               mv.visitInsn(Opcodes.POP);
>               mv.visitInsn(Opcodes.DCONST_0);
>           } ;
>
> which to me is very similar to other blocks that work just fine. Without
> this section the code generates fine.
>
>        [exec] error(100): /home/dave/dev/pixelle/etc/Pixelle.g:614:30:
> syntax error: antlr: NoViableAltException(62@[722:4: ( ( id ( ASSIGN |
> PLUS_ASSIGN ) ( atom | block ) ) (sub= ebnfSuffix[root_0,false] )? | a=
> atom (sub2= ebnfSuffix[$a.tree,false] )? | ebnf | FORCED_ACTION | ACTION
> | p= SEMPRED ( IMPLIES )? | t3= tree_ )])
>        [exec] error(100): /home/dave/dev/pixelle/etc/Pixelle.g:614:30:
> syntax error: antlr: NoViableAltException(62@[722:4: ( ( id ( ASSIGN |
> PLUS_ASSIGN ) ( atom | block ) ) (sub= ebnfSuffix[root_0,false] )? | a=
> atom (sub2= ebnfSuffix[$a.tree,false] )? | ebnf | FORCED_ACTION | ACTION
> | p= SEMPRED ( IMPLIES )? | t3= tree_ )])
>        [exec] error(100): /home/dave/dev/pixelle/etc/Pixelle.g:0:1:
> syntax error: assign.types: MismatchedTreeNodeException(0!=29)
>        [exec] error(100): /home/dave/dev/pixelle/etc/Pixelle.g:0:: syntax
> error: assign.types: NoViableAltException(3@[])
>        [exec] error(100): /home/dave/dev/pixelle/etc/Pixelle.g:0:1:
> syntax error: assign.types: MismatchedTreeNodeException(3!=28)
>        [exec] error(10):  internal error:
> /home/dave/dev/pixelle/etc/Pixelle.g : java.util.NoSuchElementException:
> can't look backwards more than one token in this stream
>
>
> Any idea what i'm doing wrong?
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list