<div class="gmail_quote">On Wed, Feb 23, 2011 at 9:46 PM, Eric Niebler <span dir="ltr"><<a href="mailto:eric@boostpro.com">eric@boostpro.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":4hs">OK, this seems like a stupid question, and maybe it is. What should be<br>
considered a "child" of an expression in the AST? Imagine a node that<br>
holds both a rewritten tree (that will be used for code-gen purposes) as<br>
well as the original AST as the user wrote it. (This is the<br>
PropertyAccessOperator node as suggested by John McCall.) Clearly, the<br>
rewritten node is a child. But is the original expression? What does is<br>
really mean to be a child?</div></blockquote></div><br><div>I don't know about the specific case you're referring to, but in general, a child of an expression is some other expression of which the parent is composed. I think an example explains it best: "x + y" is an expression, the binary operator "+". It contains two child expressions, "x" and "y".</div>
<div><br></div><div>I wouldn't expect the rewritten node and the original node to have any parent / child relationship. That relationship should be reserved for nodes that are part of the same tree structure. IE, what a consumer (say codegen) would walk to get a "complete" view of the program, whether that view is semantic or syntax oriented in nature.</div>
<div><br></div><div>Look at the relationship of a template specialization's AST nodes and the template definition's AST nodes -- neither is the child of the other, but we  create a separate connection between them so we can navigate from a definition to all specializations and from a particular specialization back to the definition.</div>