-
Notifications
You must be signed in to change notification settings - Fork 40
Description
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 ".