introducing semantic analyzer to encapsulate broken syntax tree handling
- as a result removing a bunch of ifs in the parser code