home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,778 of 2,753   
   Gary Oblock to eliben   
   Re: parent pointers in AST nodes   
   14 Dec 09 23:19:57   
   
   From: mwso@earthlink.net   
      
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca