
Dear python-dev, I've been working on a port of cpython/Grammar/python.gram from C (as currently used in all the {} expressions to build the AST) to Python, directly building nodes via the ast package. My motivation for this (as opposed to calling ast.parse, which uses the C parser) is to make it easy to experiment with adding features to the syntax, without having to build CPython. Porting is mostly straightforward, but it is a fair amount of work, because there are a lot of expressions to port My first question is whether anyone is working on this as well (or has already done so and I missed it), to avoid duplication of effort. Assuming not, my next question is where this belongs. Some natural options I see: 1. Add it to cpython as a grammar maintained in parallel with the C grammar. This would mean more maintenance when the grammar changes, but the plus side is it guarantees that the two grammars (and ast) remain synchronized. 2. PyPy 3. 3rd party library (e.g., my own repo) Let me know what you think would be best. Erik -- Erik Demaine | edemaine@mit.edu | http://erikdemaine.org/

Hi Erik, My first question is whether anyone is working on this as well (or
hasalready done so and I missed it), to avoid duplication of effort.
We have already done this work. This was a contribution by Matthieu Dartiailh: https://github.com/we-like-parsers/pegen/blob/main/data/python.gram I hope you find this useful, Cheers from cloudy London, Pablo On Thu, 23 Sept 2021 at 20:10, Erik Demaine <edemaine@mit.edu> wrote:

Hi Erik, My first question is whether anyone is working on this as well (or
hasalready done so and I missed it), to avoid duplication of effort.
We have already done this work. This was a contribution by Matthieu Dartiailh: https://github.com/we-like-parsers/pegen/blob/main/data/python.gram I hope you find this useful, Cheers from cloudy London, Pablo On Thu, 23 Sept 2021 at 20:10, Erik Demaine <edemaine@mit.edu> wrote:
participants (2)
-
Erik Demaine
-
Pablo Galindo Salgado