[antlr-interest] Mismatched Tree Node and lack of StringTemplate output
jaluber at gmx.de
Wed Jun 6 14:31:19 PDT 2007
Cameron Palmer wrote:
> I created a rule to appear in my AST that involved an imaginary token:
> : id COLON INT EOL
> iStructElements -> ^(ISTRUCT id INT iStructElements)
> Where ISTRUCT is defined:
> ISTRUCT :;
> This throws a warning:
> The following token definitions are unreachable: ISTRUCT.
> Should I worry about this?
It means, that from the start rule on there is no rule which references
ISTRUCT. It seems, that ANTLR doesn't discover that ISTRUCT is actually
used. Maybe you should put ISTRUCT into a token command. Then the error
> Second question...
> I am getting This error:
> SDFWalker.g: node from line 0:0 mismatched tree node: DOWN expecting
I believe that your grammar doesn't generate the AST correctly. I'd look
in the AST consuming grammar for VERSION and then in the AST creating
grammar for places, where you forgot to put VERSION in. I didn't use the
AST functionality yet, so this may be off.
More information about the antlr-interest