Closed edemaine closed 3 years ago
I believe such a PR would be welcome. This repo focuses on the pure python parser generation while the cpython repo focuses more on the generation of the C parser. So there is some non ideal duplication but for your case a PR against this repo is the most appropriate I would say.
Every time I run pegen on the same grammar, I (often) get a different order for
KEYWORDS
andSOFT_KEYWORDS
. This is annoying for version control, whenparse.py
is committed to a repo.I imagine the cause is that the keywords are stored in a
set
which has nondeterministic order, andsorted
will make this behavior deterministic. Specifically,tuple(...)
should be replaced withtuple(sorted(...))
in these lines:https://github.com/we-like-parsers/pegen/blob/31f489a16ba961be2b7142789f54e4a02561acbc/src/pegen/python_generator.py#L240-L241
Is it appropriate to make PR here, or would it be better against cpython?