Refactored grammar to include REPL commands, types, and formulae