now consumes the tree generated by the C++ code