build parse tree