[antlr-interest] Re: SQL grammar tree construction problem

Thomas Brandon tom at psy.unsw.edu.au
Thu Nov 13 16:37:26 PST 2003


Sorry, that was poorly stated, yes a tree must have a root, but it 
need not have a unique root, it can have a root with siblings not 
just children, but JTree doesn't like this.
So ROOT SIB1 SIB2 is a valid tree (i.e. ROOT with siblings SIB1 and 
SIB2. You don't need to have #(ROOT SIB1 SIB2) (i.e. a unique root 
with 2 children). But JTree only renders the first top-level node, 
i.e. for #(ROOT CHILD1 CHILD2) SIB1 SIB2 (i.e. root with two 
children and two siblings) it will only show #(ROOT CHILD1 CHILD2), 
SIB1 and SIB2 are not shown.

Tom.
--- In antlr-interest at yahoogroups.com, "micheal_jor" 
<open.zone at v...> wrote:
> --- In antlr-interest at yahoogroups.com, "Thomas Brandon" <tom at p...> 
wrote:
> > Not sure that this is the problem but...
> > I don't think Antlr requires rooted trees.
> 
> As Ter pointed out in a different thread a coupla days ago, ANTLR
> doesn't generate concrete syntax tree (CSTs) by default.
> 
> AFAICT, this ensures ANTLR doesn't generate a rooted subtree for 
each
> rule by default. It is up to the grammar developer to specify the
> exact structure of the generated AST. Of course a tree has to have 
a root.
> 
> Cheers,
> 
> Micheal


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list