[antlr-interest] Mismatched Tree Node and lack of StringTemplateoutput
jimi at temporal-wave.com
Wed Jun 6 14:55:59 PDT 2007
When you say that ISTRUCT is defined as:
Do you meant that your lexer rule for the token is empty, or that you
have declared it in the tokens section as an imaginary? If the former
then it isn't a valid token definition, if the latter then this is
usually a warning that will eventually go away, about imaginary tokens
not being declared in the lexer.
I think that you are trying to define and use an imaginary token
Which you can then use in your rewrite rule. Indeed that is mostly what
they are for.
Your AST error sounds like something unrelated to this though in that
your parser is not producing the tree that your tree parser is
You need to check that your tree grammar rule matches exactly the tree
you are producing. You need to produce syntactically perfect trees and
also a grammar that considers what you are producing to be that syntax
So if you explicit or implicit tree production produces
^(FRED ^(VERSION blah))
But your tree parse is actually looking for:
^(FRED VERSION blah)
Then this is the kind of thing you are going to see.
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Cameron Palmer
Sent: Wednesday, June 06, 2007 1:38 PM
To: ANTR Interest
Subject: [antlr-interest] Mismatched Tree Node and lack of
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:
This throws a warning:
The following token definitions are unreachable: ISTRUCT.
Should I worry about this?
I am getting This error:
SDFWalker.g: node from line 0:0 mismatched tree node: DOWN expecting
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest