first do the semantic check and if there are no errors do the typestate check