[antlr-interest] Grammer question

Ney, Richard richard.ney at aspect.com
Wed Nov 6 23:33:03 PST 2002


I have a question on formatting a grammer rule to construct the AST tree a
certain way. Say we have a grammer that allows these constructs

Construct 1) column1 + column2 alias1, column3
Construct 2) (column1 + column2) alias1, column3

Column1, column2 and alias as basic identifiers and the desired tree looks
like

alias1----
   | 	|  
   |	+----------
   |		| 
   |		column1
   |		column2
column3

I figure I can do something with the ^ to make various item root. Also the
parens are option and I don't want them in the tree constuct. Is it possible
to combine ! and ?

-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.


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


More information about the antlr-interest mailing list