[antlr-interest] if ( ) {

Kay Röpke kay.roepke at epublica.de
Mon Jul 31 06:02:54 PDT 2006


On 31. Jul 2006, at 14:31 Uhr, Denis Washington wrote:

> I have a major problem with the code generation of ANTLR v3. After
> generating code for my grammar file (see below), I get the following
> error message when compiling:
>
> ./SchlichtParser.java:2352: illegal start of expression
>            if (  ) {
>                  ^
>
> I use version 3.0b3.
>
> Here's the grammar file (some bits taken from the Java example  
> grammar):

Hi!

Well, the problem is that you do all your lexical analysis in the  
parser.
Lexer rules must be all-uppercase.
Simply changing all rules below the comment "Lexical analysis" to  
uppercase (and all the references, too)
at least makes it compile without a glitch.

There might be other problems with the grammar, but I cannot look  
into that right now, due to time issues :(

HTH,

-k


More information about the antlr-interest mailing list