[lab2] Added methods for parsing and printing tree and generating tree