we-like-parsers / pegen

PEG parser generator for Python
https://we-like-parsers.github.io/pegen/
MIT License
150 stars 32 forks source link

Support for python 3.7 #63

Open ahupp opened 2 years ago

ahupp commented 2 years ago

I have a patch to make pegen generate parsers that work in python 3.7, primarily by not using the walrus operator: https://github.com/ahupp/pegen/tree/python37

The generated code is pretty ugly and 3.7 is EOL in a year so I would not suggest merging it, but if anyone else is unfortunate enough to need python 3.7 support they might find this handy.

0dminnimda commented 2 years ago

Nice start, although this implementation doesn't pass a lot of tests. Here's a fixed one, that passes every test like the main branch: https://github.com/0dminnimda/pegen/tree/no_walrus

0dminnimda commented 2 years ago

Update: implroved the implementation, now it should be faster + generated code is more beautiful, additional variables such as __last are not used anymore