Re: yacc parse tree

Joachim Durchholz <joachim.durchholz@munich.netsurf.de>
19 Dec 1998 11:26:45 -0500

          From comp.compilers

Related articles
yacc parse tree josh_adams@bmc.com (Josh Adams) (1998-12-10)
Re: yacc parse tree simon.cozens@pembroke.oxford.ac.uk (Simon Cozens) (1998-12-13)
Re: yacc parse tree mikesw@whiterose.net (1998-12-13)
Re: yacc parse tree bob@werken.com (1998-12-18)
Re: yacc parse tree belinfan@cs.utwente.nl (1998-12-18)
Re: yacc parse tree josh_adams@bmc.com (Josh Adams) (1998-12-19)
Re: yacc parse tree joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-12-19)
Re: yacc parse tree scinar@ug.bcc.bilkent.edu.tr (Sukru Cinar) (1998-12-21)
Re: yacc parse tree scinar@ug.bcc.bilkent.edu.tr (Sukru Cinar) (1998-12-22)
Re: yacc parse tree AMartin@ma.ultranet.com (Alan H. Martin) (1999-01-02)
Re: yacc parse tree scinar@ug.bcc.bilkent.edu.tr (Sukru Cinar) (1999-01-02)
Re: yacc parse tree buzzard@world.std.com (1999-01-02)
| List of all articles for this month |
From: Joachim Durchholz <joachim.durchholz@munich.netsurf.de>
Newsgroups: comp.compilers
Date: 19 Dec 1998 11:26:45 -0500
Organization: Compilers Central
References: 98-12-018 98-12-022 98-12-038
Keywords: parse, design

John wrote:
>
> |> [Any tree is a tree of trees, it's a recursive data structure. No
> |> cleverness required here. -John]


Nope, a tree is a list of trees. A tree of trees would be something
where the nodes are trees in themselves. This can be useful for writing
semantic actions for EBNF grammars, e.g. for productions like
    foo ::= (baz bar*)*
I think this is more a conceptual tool than something that should be
implemented in real software, but I haven't pursued the thought too far.


Regards,
Joachim
[I think we have a difference of terminology. A binary tree is a list
of binary trees, but an N-ary tree is a tree of trees. When parsing a
language like C, I've found it useful to have tree nodes with
different numbers of subnodes, so you can directly represent the
three subexpressions of ternary operators like ? : , or with an if/else
the condition and the two branches. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.