Rewrote grammar to use correct notation and added switch statement