fix error check
Complete the function which builds syntax tree.

Most bad patterns will be caught. Then, return "Left ErrMsg".
Otherwise, "Right Tree" will be returned.