Refactor REPL command parser, improving error messages at the REPL