[antlr-interest] ANTLRWorks interpreter issue

Eugene Toder eltoder at gmail.com
Sun Sep 13 07:30:08 PDT 2009


Hi all,

Apologies if this is already known (I found similar issues in JIRA,
but I'm not sure if this is the same thing).
I've found an issue with interpreter where it doesn't consume the
second alternative in (a | b)* expression. In a simple example this
leads to incomplete parse tree, in more complex cases this leads to
NoViableAltException.
In all cases the grammar works as expected in the debugger.

Examples:

1) simple
grammar test;

brackets        :       expr (call | index)*;

call    :       '(' expr ')';

index   :       '[' expr ']';

expr    :       IDENT;

IDENT   :       ('a'..'z')+;

2) now adding another rule on top of that
grammar test;

member  :       brackets ('.' brackets)*;

brackets        :       expr (call | index)*;

call    :       '(' expr ')';

index   :       '[' expr ']';

expr    :       IDENT;

IDENT   :       ('a'..'z')+;


Is this a bug or am I missing something here?

Thanks,
Eugene


More information about the antlr-interest mailing list