by eatonphil · 4y ago · 0 comments
For decades it has been easy and common to implement parsers by hand.
From what I can tell, universities and textbooks just overcomplicated the process by teaching parser generators.
I have done a few studies of various open source ecosystems now and (edited: other than CPython) I haven't seen PEG parsers really used in anything but toy implementations of things.
PEGs allow the generator input to more closely match the mental model programmers have, *LR require the language to be structured just a little differently than how most people think it.
I'd be curious to read any posts/papers you've got that have benchmarks that show performance to be a reason.
…which also implies that it used to be hard and now isn’t.
The parser was never handwritten.
The whole idea of PEGs is that they’re specifically not declarative - they’re an imperative way to express a parser.