started working on function that constructs parse tree