[antlr-interest] JavaEmitter update questions

Vaios Kalpias akiskal at hol.gr
Sat Apr 8 18:30:51 PDT 2006


I have made some progress updating the JavaEmitter class for Java 1.5, 
but I'd like to ask a few questions. First, I'd like to let you all know 
that I'm using the grammar that can be found at the ANTLR files. The 
first major difficulty I faced was implementing the 
classOrInterfaceType. This rule is as follows:

classOrInterfaceType
   :    IDENT (typeArguments)?
   |    #( DOT classOrInterfaceType )
   ;

typeArguments
   :    #(TYPE_ARGUMENTS (typeArgument)+)
   ;

typeArgument
   :    #(    TYPE_ARGUMENT
           (    typeSpec
           |    wildcardType
           )
       )
   ;

The problem is that I don't understand how am I going to put 
classOrInterfaceType in the big switch statement since antlr does not 
"setType" a #CLASSORINTERFACETYPE. I figured that in this case we follow 
the rule until we find a # symbol, which is then inserted in the switch 
statement. But in this case classOrInterfaceType ends up using IDENT 
(typeArguments)? and IDENT is never a root node in the AST. I hope I 
made u understand my question!! There are more things I'm trying to 
figure out, but if I understand this I believe I'll solve my other 
problems too.

Regards,
Vaios.


More information about the antlr-interest mailing list