[antlr-interest] Error: TokenStreamException while reading Grammer

Gavin Lambert antlr at mirality.co.nz
Mon Feb 2 11:53:57 PST 2009


At 21:45 2/02/2009, Chal Chale apne Ghar wrote:
>D:\Actuate\Samplelexer-parser\ConversionTool>java antlr.Tool 
>vb_org.txt
>ANTLR Parser Generator   Version 2.7.5 (20050128)   1989-2005 
>jGuru.com
>error: Token stream error reading grammar(s):
>vb_org.txt:45:7: expecting ''', found 'p'
>TokenStreamException: expecting ''', found 'p'
>
>as seen, i am getting TokenStream Exception. But when i am using 
>AntlrWorks to check the Grammer syntax, it is showing correct to 
>me.

You're running ANTLR v2 on the command line, but ANTLRWorks is for 
ANTLR v3.  To run ANTLR v3, you need to use "org.antlr.Tool", not 
"antlr.Tool".

Also, by convention grammar files have a .g extension.  This 
doesn't really matter (ANTLR will still happily compile the file 
regardless of extension), but it's a good idea to follow the 
convention, since that's what tools are expecting.



More information about the antlr-interest mailing list