completed grammar rewrite for new ANTLR capabilities