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


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to