[antlr-interest] Changing AST order in a complex rule

Ney, Richard richard.ney at aspect.com
Wed Mar 12 16:52:44 PST 2003


Never mind, I should have done a little more RTFM. Taking over tree
construction works well for this.

 

select_statement! 

      :     (sc:select_clause trl:table_reference_list (wc:whereClause)?
(gc:group_clause)? (oc:order_clause)?)

      {

            #select_statement = #(select_statement, trl, sc, wc, gc, oc);

      }

      ;

 

-Richard

 

-----Original Message-----
From: Ney, Richard [mailto:richard.ney at aspect.com] 
Sent: Wednesday, March 12, 2003 3:10 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Changing AST order in a complex rule

 

I have a simple SQL grammar that has the top rule of:

 

select_statement 

      :     (select_clause table_reference_list (whereClause)?
(group_clause)? (order_clause)?)

      ;

 

Now this creates a basic AST with the elements as the root nodes. Now I want
to change the order of the AST so me tree parser hits the
table_reference_list as its first element. How would I change this rule to
make the AST outcome?

 

-Richard

 

----------------------------------------------------------------------------
------------------------

Richard Ney                                                    Aspect
Communications

Principal Software Engineer

< <http://www.aspect.com/> http://www.aspect.com>
Main:  408.325.2200

< <mailto:richard.ney at aspect.com> mailto:richard.ney at aspect.com>
SJ Office: 408.325.2464

 
Home Office: 916.797.9602

----------------------------------------------------------------------------
------------------------

 

The Three Laws of Infernal Dynamics:
1. An object in motion will always be headed in the wrong direction.
2. An object at rest will always be in the wrong place.
3. The energy required to change either of these states will always be more
than you wish to expend, but never so much as to make the task appear
prospectively impossible.

 


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030312/91438840/attachment.html


More information about the antlr-interest mailing list