[antlr-interest] v3: strange debugging message in new java.g grammar

Terence Parr parrt at cs.usfca.edu
Mon Jul 10 14:20:51 PDT 2006


On Jul 10, 2006, at 12:14 PM, Dieter Frej wrote:

> Hi everybody,
>
> since Terence wrote that the new Java grammar was not tested
> exhaustively, I thought I could do that. So I wrote the following  
> small
> program and ran it (java JCKParsing.java 2>err.txt).

By default ANTLR does not send the exceptions back out...it tries to  
recover.  Override reportError and recover if you want; also can set  
trycatchclause action I think it is.
>
> I got the following in my err.txt and I have no idea where this came
> from because it does not look like an exception (they should all be
> handled).
>
> /home/db/jck/JCK-compiler-15a/tests/lang/FP/fpl001/fpl00101m8/ 
> fpl00101m8.java
> [compilationUnit, typeDeclaration, classOrInterfaceDeclaration,  
> classDeclaration, normalClassDeclaration, classBody,  
> classBodyDeclaration, memberDecl]: line
>  20:18 decision=<<132:1: memberDecl :  
> ( ( genericMethodOrConstructorDecl )=>  
> genericMethodOrConstructorDecl | ( methodDeclaration )=>  
> methodDeclaration | (
> fieldDeclaration )=> fieldDeclaration | ( 'void' Identifier  
> voidMethodDeclaratorRest )=> 'void' Identifier  
> voidMethodDeclaratorRest | ( Identifier construct
> orDeclaratorRest )=> Identifier constructorDeclaratorRest |  
> ( interfaceDeclaration )=> interfaceDeclaration |  
> classDeclaration );>> state 15 (decision=36) n
> o viable alt; token=[@106,466:468='int',<59>,20:18]
> [compilationUnit, typeDeclaration, classOrInterfaceDeclaration,  
> classDeclaration, normalClassDeclaration, classBody,  
> classBodyDeclaration, memberDecl, const
> ructorDeclaratorRest, formalParameters]: line 20:53 mismatched  
> token: [@119,501:508='strictfp',<54>,20:53]; expecting type ')'
> ---------------
> Any comments on this?

That says that in formalParameters, it didn't like strictfp.   
Hmm...must be a bug in the spec.  I did this:

formalParameterDecls
         :       'final'? annotations? type formalParameterDeclsRest?
         ;

seems like strictfp, a modifier, needs to be in there.  Maybe I  
simplified.  what's at line 20, char 53?

Ter


More information about the antlr-interest mailing list