Added test cases of parser, fixed bugs of algorithm 3.2