add code for checking exception to grammar