Functionality for constructing parse tree from annotations