Move grammar into separate class

This separates the logic from the grammar used
by the parser vs. the actual object that performs
the parsing.