result.name := "Model"; var box: Box := object Box { name := "Box node"; }; var subBox : Box := object Box { name := "SubBox"; }; result.root := box; box.children += subBox; subBox.children += box;
subBox.children += box;
Pass 1 creates the output as a tree, and populates an in2out Dict.
Pass 2 adds cross-references to the tree using the in2out Dict from pass 1.