we-like-parsers / pegen

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

[Feature] Optionally create `.pxd` files #69

Open 0dminnimda opened 2 years ago

0dminnimda commented 2 years ago

If the creation of a parser using c was prohibited, because the original cpython pegen used too much internal functionality, then we can at least make python parser faster with cython.

Since pegen knows all the variables and types that users provide, it can use this information to create a .pxd file. This file will not interfere with pure python parser work, but it can be used by cython to create a faster compiled version of the parser.

I will implement this functionality anyway, but I wonder should I make it into PR and try to merge it here? Is this feature needed here?

MatthieuDartiailh commented 2 years ago

I would be interested in such a feature. And I could help review a PR.

0dminnimda commented 2 years ago

Wonderful!

0dminnimda commented 2 years ago

I forgot that right now cython does not support walrus operator, so for this change to be work at all we will probably need to merge this branch as well.