It's great to see that you finally managed to come up with a PEP, this work becomes concrete: congrats!
I started to read the PEP, and it's really well written! I heard that LL(1) parsers have limits, but this PEP explains very well that the current Python grammar was already "hacked" to work around these limitations. I also like the fact that PEG is deterministic, whereas LL(1) parsers are not.
I like to have the new parser being the default, it will ease its adoption and force users to adapt their code. Otherwise, the migration may take forever and never complete :-(
About the migration, can I ask who is going to (help to) fix projects which rely on the AST?
I know that the motto was always "we don't provide any backward compatibility warranty on the AST", *but* more and more projects are using the Python AST.
Examples of projects relying on the AST:
* gast: used by Pythran * pylint uses astroid * Chameleon * Genshi * Mako * pyflakes * (likely others)
I'm not asking to stop making AST changes. I'm following AST changes, and the AST is becoming better and better at each Python release!
I'm just asking is there are volunteers around to help to make these projects compatible with Python 3.9, before the Python 3.9.0 final release (to accelerate the adoption of Python 3.9). These volunteers don't have to be the ones behind the PEP 617.
Note: example of previous AST incompatible changes (use ast.Constant, remove old AST classes) in Python 3.8: https://bugs.python.org/issue32892 A compatibility layer was added to ease the migration from old AST classes to the new ast.Constant.
Le jeu. 2 avr. 2020 à 20:15, Guido van Rossum email@example.com a écrit :
Since last fall's core sprint in London, Pablo Galindo Salgado, Lysandros Nikolaou and myself have been working on a new parser for CPython. We are now far enough along that we present a PEP we've written:
Hopefully the PEP speaks for itself. We are hoping for a speedy resolution so we can land the code we've written before 3.9 beta 1.
If people insist I can post a copy of the entire PEP here on the list, but since a lot of it is just background information on the old LL(1) and the new PEG parsing algorithms, I figure I'd spare everyone the need of reading through that. Below is a copy of the most relevant section from the PEP. I'd also like to point out the section on performance (which you can find through the above link) -- basically performance is on a par with that of the old parser.
============== Migration plan ==============
This section describes the migration plan when porting to the new PEG-based parser if this PEP is accepted. The migration will be executed in a series of steps that allow initially to fallback to the previous parser if needed:
Before Python 3.9 beta 1, include the new PEG-based parser machinery in CPython with a command-line flag and environment variable that allows switching between the new and the old parsers together with explicit APIs that allow invoking the new and the old parsers independently. At this step, all Python APIs like ``ast.parse`` and ``compile`` will use the parser set by the flags or the environment variable and the default parser will be the current parser.
After Python 3.9 Beta 1 the default parser will be the new parser.
Between Python 3.9 and Python 3.10, the old parser and related code (like the "parser" module) will be kept until a new Python release happens (Python 3.10). In the meanwhile and until the old parser is removed, **no new Python Grammar addition will be added that requires the peg parser**. This means that the grammar will be kept LL(1) until the old parser is removed.
In Python 3.10, remove the old parser, the command-line flag, the environment variable and the "parser" module and related code.
-- --Guido van Rossum (python.org/~guido) Pronouns: he/him (why is my pronoun here?) _______________________________________________ Python-Dev mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://firstname.lastname@example.org/message/HOZ2RI3F... Code of Conduct: http://python.org/psf/codeofconduct/