Hi,

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.

Victor

Le jeu. 2 avr. 2020 à 20:15, Guido van Rossum <gu...@python.org> 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:
>
> https://www.python.org/dev/peps/pep-0617/
>
> 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:
>
> 1.  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.
>
> 2.  After Python 3.9 Beta 1 the default parser will be the new parser.
>
> 3.  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.
>
> 4.  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 -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/HOZ2RI3FXUEMAT4XAX4UHFN4PKG5J5GR/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/6X7OFZPG7URY5AK3ZKFJNGHUXXHMKNS4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to