[antlr-interest] AST rewriting

Bernardo Elayda belayda at gmail.com
Tue Jul 1 10:18:58 PDT 2008


Hi!
Try this instead:

def : ^(DEF name mylabel=expr) -> ^(DEF name $mylabel.value)

hth,
Bernardo Elayda


----------------------------
def : ^(DEF name expr)
     ;
name : <<some rules>>;

expr  returns [String value]
     : <<some rules>>
     ;


I've been trying to do this rewrite:

def : ^(DEF name expr) -> ^(DEF name $expr.value)

(I'm writing a name resolver ...)


But antlr complains saying there is a reference to an undefined rule
'value'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080701/d13cab3a/attachment.html 


More information about the antlr-interest mailing list