[antlr-interest] Problem with " => " operator

Wincent Colaiuta win at wincent.com
Tue Jun 19 14:38:34 PDT 2007


El 19/6/2007, a las 23:07, Ali Salehi escribió:

> Hi all,
>
>  I'm a beginner Antlr user, I bought the antlr v3 reference book  
> and I'm trying to get SQL-92 simplified select statement parser  
> working.
>
>  I have some strange issues with the antlr, for instance, when I  
> want to test the following grammar inside AntlrWorks GUI:
>
> grammar t;
> k :	(A)=>A |A;
> A	:	'a';
>
> I see that antlr fails to parse my sample input which is simply   
> the character of "a"  [without qutations ;) ].
>
> It says: NoViableException
>
> The grammar is so simple that I barely can see any error there, I  
> appreciate some comments
> from more advanced users :-) .

I'm definitely not an advanced user, but I pasted your grammar  
straight into ANTLRWorks with input "a" and the parse tree returned  
by the debugger was:

   root
    |
    k
    |
  /   \
(a)   a

Where the left "a" is the syntactic predicate, which succeeds, so the  
parser then backtracks and matches "a".

Wincent




More information about the antlr-interest mailing list