[antlr-interest] Complaints about BaseAST implementation

Oliver Zeigermann oliver.zeigermann at gmail.com
Wed Oct 12 14:28:42 PDT 2005


2005/10/12, Akhilesh Mritunjai <virtualaspirin at yahoo.com>:
> --- Terence Parr <parrt at cs.usfca.edu> wrote:
> > Correct and correct. :)  BaseAST was meant simply to
> > abstract out the child-sibling tree part so anybody
> > could subclass to add fields like string and token
> > type etc...  If you don't want a child-sibling, then
> > implement AST.
>
> Wrong and wrong impression :)
>
> BaseAST is just a AST algorithms class. AST, by
> definition is a tree. So there is nothing wrong with
> child-sibling relation... it is fundamental to a tree
> and at this hour I fail to see any other way a 'tree'
> can be defined. So there is nothing like a 'If you
> don't want a child-sibling'... they are required.

What about a list of children associated to each node? This way there
is no explicit notion of a sibling or 'left'. Preferred when you are
working with a remote RDBMS where each request has high overhead, so
you might want to retrieve all children in one request.

You could also let each node know who is its parent. This is the only
required information I guess, but in most cases this would be a sick
implementation, though.

Oliver


More information about the antlr-interest mailing list