I fully agree. As I pointed out in my paper, PEG is not good at specifying lexical structures. But, if I need an ad hoc parser, I would prefer to skip
a separate lexer. So, my question is: how could one modify PEG
to facilitate this, and at the same time have a decent speed?

Rats! performs a number of optimizations that are specifically designed to reduce the overhead when recognizing lexical syntax. For my experiments with Java, the overall result is performance pretty close to ANTLR 2.7.5. So, I'm not worried about using PEGs for lexical syntax.

Furthermore, once you combine both lexical and hierarchical syntax, i.e., rely on scannerless parsing, you can do strictly more. Martin Hirzel and I have combined the complete Java and C languages into a new language (called Jeannie) to substantially simplify Jave Native Interface programming. The syntactic composition of the existing grammars for Java and C was trivial thanks in part to scannerless parsing. Several papers by Eelco Visser make a similar case for other language extensions, only they are building on a scannerless GLR parser generator.

Robert

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to