Re: parent pointers in AST nodes

Gary Oblock <mwso@earthlink.net>
Mon, 14 Dec 2009 23:19:57 -0800

          From comp.compilers

Related articles
[3 earlier articles]
Re: parent pointers in AST nodes idbaxter@semdesigns.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 bartc@freeuk.com (bartc) (2009-11-30)
Re: parent pointers in AST nodes torbenm@diku.dk (2009-11-30)
Re: parent pointers in AST nodes kkylheku@gmail.com (Kaz Kylheku) (2009-12-01)
Re: parent pointers in AST nodes quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2009-12-01)
Re: parent pointers in AST nodes mwso@earthlink.net (Gary Oblock) (2009-12-14)
| List of all articles for this month |

From: Gary Oblock <mwso@earthlink.net>
Newsgroups: comp.compilers
Date: Mon, 14 Dec 2009 23:19:57 -0800
Organization: Compilers Central
References: 09-11-060
Keywords: AST, analysis
Posted-Date: 18 Dec 2009 20:01:21 EST

eliben wrote:


> 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
> well?
>
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




--
--
Bronze Dreams
http://www.bronzedreams.com



Post a followup to this message

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