I agree with Terence in that ambiguity vs. ordering is a trade-off.
With CFGs you may get unnecessary ambiguity and with PEGs you may get
subtle ordering errors. As Terence points out, I had a (very) few in
my Java grammar.
The key difference, however, is that CFGs are only closed under
composition if you use GLR parsing, while PEGs are always closed
under composition. As a result, providing modularity for PEGs is
simpler and faster than for CFGs. That closes the deal for me...
Robert
Hi David. :) Yes, but just because something is unambiguous,
doesn't mean you get what you expect. Recall the dreaded:
A -> a
A -> ab
problem where the second alt is unreachable. A CFG will deal with
this no problem. This problem occurs in real grammars I find,
after having built a Java and C grammar using ANTLR's hybrid LL(*)/
PEG strategy. It would be worse with straight PEG. My LL(*) found
some errors in Grimm's Java grammar, but in general I believe he
would disagree that it's a serious problem.
I merely point out that it is an issue in the wild; the size of the
problem is open to debate. You can quote me on that. ;)
Ter
_______________________________________________
PEG mailing list
[EMAIL PROTECTED]
https://lists.csail.mit.edu/mailman/listinfo/peg
_______________________________________________
PEG mailing list
[EMAIL PROTECTED]
https://lists.csail.mit.edu/mailman/listinfo/peg