[antlr-interest] ANTLR 3.4 not generating compilable Parser file Java target

Karishma Chadha kchadha at wellesley.edu
Tue Jul 24 08:42:54 PDT 2012


I have been using ANTLR 3.4 to generate a Lexer and Parser for my language
in a Java target. Yesterday, I got a compiler error when trying to compile
my generated parser file which looks like this:

VenthonParser.java:9621: illegal start of expression
        void  =null;
VenthonParser.java:9692: illegal start of expression
        void  =null;

One of the corresponding chunks of code in the Parser is as follows (the
other one is similar):

 public final void synpred81_Venthon_fragment() throws RecognitionException
        void  =null;

        // Venthon.g:585:5: ( ( PLUS | MINUS ) b= term )

        // Venthon.g:585:5: ( PLUS | MINUS ) b= term

        if ( input.LA(1)==MINUS||input.LA(1)==PLUS ) {
        else {
            if (state.backtracking>0) {state.failed=true; return ;}
            MismatchedSetException mse = new
            throw mse;


        if (state.failed) return ;


I have seen some of the other messages on the ANTLR mailing list saying
that this is a known issue in ANTLR 3.4 that was fixed but then backed out
again. Is there any solution to this even if it is just a temporary one
until the next release? I would prefer not to have to switch to a previous
version of ANTLR if that can be avoided. I need to continue using ANTLR in
my project and I am on a tight deadline.

Please let me know if there are any solutions.
Thank you!

*Karishma Chadha*

More information about the antlr-interest mailing list