[antlr-interest] trouble running Antlr on grammar file

John B. Brodie jbb at acm.org
Tue Apr 20 11:20:05 PDT 2010


Greetings!

On Tue, 2010-04-20 at 13:51 -0400, Kumar, Rajesh (Systems) UTRC wrote:
> Hi everyone,
> 
> I created a simple expression grammar in a .g file. I checked it with Antlrworks to see that there were no errors in the grammar.  The grammar is the following:
> 
> ****************
> grammar		 Expression; 
> 
....stuff snipped....
> ********************
> 
> 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 '>'
> 

You have tried to process a v3 grammar with the v2 tool.

use: "java org.antlr.Tool Expression.g"
___________^^^^





More information about the antlr-interest mailing list