build parse tree data structure