[antlr-interest] trouble running Antlr on grammar file

Bart Kiers bkiers at gmail.com
Tue Apr 20 11:16:07 PDT 2010


On Tue, Apr 20, 2010 at 7:51 PM, Kumar, Rajesh (Systems) UTRC <
KumarR at utrc.utc.com> wrote:

> ...
>
> When I run "java antlr.Tool Expression.g" I get the following
>
> ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
> Expression.g:1:1: unexpected token: grammar
> error: Token stream error reading grammar(s):
> Expression.g:11:13: expecting ''', found '>'
> Expression.g:1:1: rule grammar trapped:
> Expression.g:1:1: unexpected token: grammar
> TokenStreamException: expecting ''', found '>'
> ...



I can't reproduce that.
Using ANTLR 3.2 and the grammar from your post, I get the following:

bart at hades:~/Temp/antlr$ java -cp antlr-3.2.jar org.antlr.Tool Expression.g
warning(200): Expression.g:11:9: Decision can match input such as "'&&'"
using multiple alternatives: 2, 4
As a result, alternative(s) 4 were disabled for that input
warning(200): Expression.g:11:9: Decision can match input such as "'->'"
using multiple alternatives: 1, 4
As a result, alternative(s) 4 were disabled for that input
warning(200): Expression.g:11:9: Decision can match input such as "'||'"
using multiple alternatives: 3, 4
As a result, alternative(s) 4 were disabled for that input


Note that the above are mere warnings, not errors (not that they shouldn't
be resolved of course...).

Regards,

Bart.


More information about the antlr-interest mailing list