Fix parser error reporting and add EOF to root rule in grammar.