[antlr-interest] Tree parser and Java interface question to passing rule results

Thomas Bernhardt bernhardttom at yahoo.com
Wed Jan 2 12:39:28 PST 2008


Can someone please help me get a tree walker to invoke a Java method for a
rule, passing the tree node representing the rule result?

I have the tree grammar as follows, and the "???" is what I'm trying to figure out:

valueExpr
    :     constant { leaveNode(???); }
    |      // ... 
    ;

constant
    :    INT_TYPE
    |    LONG_TYPE
    |    FLOAT_TYPE
   
 |    DOUBLE_TYPE
    |    STRING_TYPE
    |    BOOL_TYPE
    |    NULL_TYPE
    ;

The
goal is to get the tree or node that resulted from the "constant" rule to be
passed to the "leaveNode(Tree tree)" method. What should "???" be?

Thank you!
Tom 
http://esper.codehaus.org   Esper loves ANTLR




      Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.
<!-- DIV {margin:0px;}-->Can
you please help me get my tree walker to invoke a Java method for a
rule, passing the tree node representing the rule result?

I have the tree grammar as follows, and the "???" is what I'm trying to figure out:

valueExpr
    :     constant { leaveNode(???); }
    |      // ... 
    ;

constant
    :    INT_TYPE
    |    LONG_TYPE
    |    FLOAT_TYPE
   
 |    DOUBLE_TYPE
    |    STRING_TYPE
    |    BOOL_TYPE
    |    NULL_TYPE
    ;

The
goal is to get the tree that resulted from the "constant" rule to be
passed to the "leaveNode(Tree tree)" method. What should "???" be?

Thank you!
Tom 
http://esper.codehaus.org   Esper loves ANTLR





      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080102/a097a941/attachment.html 


More information about the antlr-interest mailing list