Message374348
Parso's incremental parser is a terrible idea. It also works and is pretty fast, but the design is pretty terrible (it took me a lot of fuzzing to make sure that it works decently well).
The basic problem is that it's reusing nodes in a mutable way. If I were to redo it, I would probably choose a similar approach to Roslyn's red/green trees. It's probably also possible to use these approaches in Python, but they might be quite a bit slower than what I'm using (because recreating nodes can be quite expensive).
I imagine that one of the biggest issues with parsing PEG in parso would be to do it with error recovery AND incremental parsing. That combination can be quite annoying, but it's definitely still possible.
I'm not really sure about the future of parso with PEG. I'm definitely going to have to find a way to parse 3.10+ (so Jedi is going to keep working), however I feel like that it's hard to achieve a fast parser in pure Python. Parso is like 20% faster, but still more than ten times slower than the CPython parser... |
|
Date |
User |
Action |
Args |
2020-07-26 22:42:01 | davidhalter | set | recipients:
+ davidhalter, gvanrossum, gregory.p.smith, carljm, eric.snow, hroncok, corona10, BTaskaya, Peter Ludemann |
2020-07-26 22:42:01 | davidhalter | set | messageid: <1595803321.2.0.712601904142.issue40360@roundup.psfhosted.org> |
2020-07-26 22:42:01 | davidhalter | link | issue40360 messages |
2020-07-26 22:42:01 | davidhalter | create | |
|