|Abstract Syntax Trees - binary tree or other, which is best? email@example.com (Ed Davis) (2000-10-01)|
|Re: Abstract Syntax Trees - binary tree or other, which is best? Joachim.Pimiskern@de.bosch.com (Joachim Pimiskern) (2000-10-08)|
|Re: Abstract Syntax Trees - binary tree or other, which is best? firstname.lastname@example.org (Tom Payne) (2000-10-08)|
|From:||Joachim Pimiskern <Joachim.Pimiskern@de.bosch.com>|
|Date:||8 Oct 2000 22:15:24 -0400|
|Organization:||Robert Bosch GmbH|
Ed Davis schrieb:
> I have read a couple of texts where the author recommends using a
> binary tree for the abstract syntax tree. In many other texts, non-
> binary trees are used, with the tree being tailored to what is being
> stored at the time.
Which data structure one should use depends on the syntactical
structure of the language being parsed. The data structure of an AST
should reflect the language. In one of my projects where I had to
expand macros in C files it was sufficient to hold a hash table under
one big root object.
Binary trees are usually used to store key-value pairs like constants
and their content, variables and their values, functions and their
context / code, but in some cases hash tables allow faster retrieval.
Return to the
Search the comp.compilers archives again.