One month ago, Austin Schick submitted an issue :
Exploring performant PEG parsing, where he suggested a new way of implementing a PEG parser in Brython. My first attempt had failed because the parsing time was much slower than the current "hand-made" parser.
The idea was to adapt the scripts used by CPython to generate the C parser (in Tools/peg_generator) to generate a Javascript parser.
After a couple of interactions with Austin, the implementation is now complete and was committed to the current development version.
This new parser is a little slower than the "hand-made" version (around 1,7 times), and the resulting Brython code in
brython.js is sligthly bigger (around 20%) but this is acceptable because of the huge benefit if brings: a full compliance with the official Python grammar, including the generation of the AST and of error messages with the "grammar actions" described in
PEP 617.
Such a big change is likely to bring errors in cases that have not been tested yet, so all of you who can test their code with the new development version are invited to do so and report bugs in the
issue tracker.