refactored semantic analyzer, improved error notifications