|[3 earlier articles]|
|Re: parent pointers in AST nodes email@example.com (Ira Baxter) (2009-11-27)|
|Re: parent pointers in AST nodes DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-11-28)|
|Re: parent pointers in AST nodes firstname.lastname@example.org (bartc) (2009-11-30)|
|Re: parent pointers in AST nodes email@example.com (2009-11-30)|
|Re: parent pointers in AST nodes firstname.lastname@example.org (Kaz Kylheku) (2009-12-01)|
|Re: parent pointers in AST nodes email@example.com (Quinn Tyler Jackson) (2009-12-01)|
|Re: parent pointers in AST nodes firstname.lastname@example.org (Gary Oblock) (2009-12-14)|
|From:||Gary Oblock <email@example.com>|
|Date:||Mon, 14 Dec 2009 23:19:57 -0800|
|Posted-Date:||18 Dec 2009 20:01:21 EST|
> When implementing an AST for some language, each AST node typically
> holds information about the language construct it represents and
> pointers to children nodes (such as a binary op node pointing to its
> left-hand and right-hand operands).
> Is it common / useful to supply a pointer to the node's parent as
Without a parent pointer the AST would be fairly worthless and it would
force the tree walking algorithms used to be overly complex. By the way,
for the sake of your sanity transform the AST into a high level IR as soon
as possible.... and use visitor patterns sparingly because they get big and
clumsy for an AST.
-- Gary Oblock
Return to the
Search the comp.compilers archives again.