refactored grammar to reduce repetition; added . as an acceptable
non-terminal character in names