Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation should clearly state that one shouldn't assume a packrat parser #57

Open
tomtau opened this issue Feb 5, 2025 · 0 comments

Comments

@tomtau
Copy link
Contributor

tomtau commented Feb 5, 2025

Discussed in pest-parser/pest#1081

Originally posted by rlpowell February 5, 2025
Because almost all PEG parsers are packrat parsers, it never occurred to me that Pest wouldn't be one, which is why I spent uh a lot of hours on pest-parser/pest#1080 , because I was trying to get enough information out of Pest to understand why something that takes https://github.com/lojban/ilmentufa/ (PEGJS) about 0.1 seconds was taking Pest ~390 seconds. (Fun fact: the input "klama" (that's the entire input, 5 characters) takes Pest 9 seconds, the input "zarci" (again, 5 characters) takes Pest 390 seconds; they both follow approximately the same path through the grammar, I have no idea what the issue is).

For those of us who have been around PEGs for a while (I was around when the original Ford paper was published), packrat is assumed, even though it's not required.

I enjoyed the work I did on that PR, and I learned a bunch, but given that Pest isn't going to be able to handle my grammar (I think if you look at https://github.com/lojban/ilmentufa/blob/master/camxes.peg , you'll agree that automatic optimization probably isn't going to do the trick), that time was time that did not advance me towards my actual goals.

I think somewhere prominent y'all should say something like "WARNING: Pest does not use packrat parsing, it instead tries to handle exponential parsing cases with automated optimizations. This is known to not work in some cases; see pest-parser/pest#685 ".

@tomtau tomtau transferred this issue from pest-parser/pest Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant