I have a tree data structure composed by parent nodes and child nodes, something like this:
<Node1>
<Node2/>
<Node3>
<Node4/>
</Node3>
</Node1>
And to parse the structure i use a μ-recursive function:
void RecursiveFunction(NodeT node)
{
if(node.has_child())
RecursiveFunction(node.child());
}
When i call RecursiveFunction passing as parameter, for example, Node2 i want to have the access to the father (Node1) data without storing these data using additional data structures, because the data of the first node has been stored on the call stack before making the recursive call. So I need to access the call stack to read data of Node1 while I am parsing Node2 failing direct access to the father, and so on.
For example, if i'm parsing Node4:
void RecursiveFunction(NodeT node)
{
/* Access to Node3 and Node1 data...
if(Node4.has_child())
RecursiveFunction(Node4.child()); */
}
Is it possible? In what way?
Thanks.