You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"python3 -m pegen python" generates a Python parser that contains invalid code #133560
OK I get it now, this is definitely a duplicate.
I think perhaps the instructions in parser.md are a bit misleading, as they suggest that when you are "adding some new rules to the grammar" (e.g. updating the python.gram), "it is a good idea to experiment first by generating a Python parser", when in fact you cannot use python -m pegen python on the modified python.gram you may be working on.
I will see if I can improve the docs once I get a better understanding on how to leverage pegen to generate a Python parser.
"it is a good idea to experiment first by generating a Python parser", when in fact you cannot use python -m pegen python on the modified python.gram you may be working on.
You can do so using the pure Python version of the grammar. I don't think it's up-to-date with the latest updates to the CPython grammar though. I need to find some time to update it.
I think we can close this as won't fix for now. If you wanna update the docs in the future, please open a new issue for that.
Activity
sobolevn commentedon May 7, 2025
This looks like a possible duplicate of #96424
alexprengere commentedon May 7, 2025
OK I get it now, this is definitely a duplicate.
I think perhaps the instructions in parser.md are a bit misleading, as they suggest that when you are "adding some new rules to the grammar" (e.g. updating the
python.gram), "it is a good idea to experiment first by generating a Python parser", when in fact you cannot usepython -m pegen pythonon the modifiedpython.gramyou may be working on.I will see if I can improve the docs once I get a better understanding on how to leverage pegen to generate a Python parser.
lysnikolaou commentedon May 7, 2025
You can do so using the pure Python version of the grammar. I don't think it's up-to-date with the latest updates to the CPython grammar though. I need to find some time to update it.
I think we can close this as won't fix for now. If you wanna update the docs in the future, please open a new issue for that.
sobolevn commentedon May 7, 2025
However, since this is not the first time people ask this - I propose adding a clear error message that this can't be done.
gh-133560: Clarified `parser.md` doc for pegen parser issue in using …