[antlr-interest] problem in this grammer file:-

Johannes Luber jaluber at gmx.de
Tue Aug 5 03:29:40 PDT 2008


faraz ahmed schrieb:
> Hi i am new to antlr .i have to use this grammer file produced by 
> somebody else . i am trying to run it.can somebody plz check those 
> errors in this grammer.
> the errors it is giving are
> ANTLR Parser Generator  Version 3.1b1 (May 20, 2008)  1989-2008
> error(100): Dfa.g:4:1: syntax error: antlr: Dfa.g:4:1: unexpected token:
>   import java.io.*;
>   import antlr.*;
>   import uk.ac.sheffield.dcs.dfa.*;
>   import uk.ac.sheffield.dcs.dfa.spec.*;
> 
> warning(149): Dfa.g:0:0: rewrite syntax or operator with no output 
> option; setting output=AST
> error(150):  grammar file Dfa.g has no rules
> error(100): Dfa.g:0:0: syntax error: assign.types: <AST>:0:0: unexpected 
> end of subtree
> error(100): Dfa.g:0:0: syntax error: define: <AST>:0:0: unexpected end 
> of subtree
> grammer file is attached with this e-mail.
> thanking you,
> faraz

The problem is that you are using a grammar for ANTLR 2.7.7 with ANTLR 
3.x. The syntax for grammars has been changed so that you have to use 
2.7.7 or to rewrite the grammar in the new syntax. There is a tool on 
the download page, which eases the effort somewhat. I believe it is 
named v2tov3 or similar.

Johannes


More information about the antlr-interest mailing list