On 6/04/20 2:08 am, Jelle Zijlstra wrote:
> The current CPython parser usually just produces "SyntaxError: invalid
> syntax" for any error, while other languages that I work with usually
> say something more precise like 'expected x, got y'. What will the error
> messages in the PEG parser look like? Making syntax errors more
> informative can be a nice improvement to usability.

Unfortunately they look pretty much the same. We're actually currently trying to improve the error messages for situations where the old parser produces something specialized (mostly because the LL(1) grammar can't express something and the check is done in a later pass).
On Sun, Apr 5, 2020 at 7:55 AM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
And related to that, how precisely will it be able to pinpoint the
location of the error? The backtracking worries me a bit in that
regard. I can imagine it trying all possible ways to parse the
input and then only being able to say "Something is wrong somewhere
in this file."

There's no need to worry about this: in almost all cases the error indicator points to the same spot in the source code as with the old parser. I was worried about this too, but it really doesn't seem to be a problem -- I think this might be different with highly ambiguous grammars, but since Python's grammar is still *mostly* LL(1), it looks like we're fine.
--Guido van Rossum (python.org/~guido)