refactor so lexer+parser keeps track of errors