[antlr-interest] More label breakage?
Gary R. Van Sickle
g.r.vansickle at att.net
Sat Feb 28 01:19:32 PST 2009
In a tree grammar this time. This should work, right?:
selection_statement returns [If *retval]
: ^(IF expression s1=statement s2=statement)
{ $retval = new If(NULL, $s1, $s2); }
| ^(IF { cout << "IF" << endl; }
expression statement)
| ^(SWITCH expression statement)
;
(C target, "ANTLR Parser Generator Version 3.1.2-2008-10-21")
It results in the following errors from ANTLR:
error(117): ss9_tree_parser.g3t:0:0: missing attribute access on rule scope:
s1
error(117): ss9_tree_parser.g3t:0:0: missing attribute access on rule scope:
s2
Broken? If I comment out the action, it gets through ANTLR and compiles,
but of course that's of little use. Apparently ANTLR is looking for
something along the lines of "new If(NULL, $something::s1, $something::s2)",
but I have no idea what $something is supposed to be, nor can I find any
documentation to that effect.
--
Gary R. Van Sickle
More information about the antlr-interest
mailing list