> hiya. A C grammar with GCC extensions is real world isn't it? I'm running > 37,000 lines of code through it. This is the Rats! C grammar that I manually > converted to ANTLR format to see if ANTLR could generate a valid parser for > it without manipulating the structure of the grammar (it can). With > memoization, it finishes in seconds. Without, it doesn't terminate. It's > still running as I write this e-mail minutes later. The only difference is > the option list in the grammar: > > grammar RatsC; > //options {backtrack=true; memoize=true; output=AST;} > options {backtrack=true; output=AST;} // doesn't terminate > > Grimm does some amazing static grammar analysis optimizations in Rats! as > well as the packratting at runtime. His parsers are very efficient as a > result. I'm assuming that the original Rats! C parser would not terminate > without packratting though just like my version.
I tried out disabling memoization quite a while ago and, yes, the C parser didn't finish for a real-world example. The larger question you, Mathias, seem to be raising is: do we really need packrat parsing for most real-world languages? Probably not. You can write corresponding parsers using LR or even LALR if you want to, just like you can program applications without automatic memory management and without modules/classes. It's just significantly more painful... Robert _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg