On 7/04/20 5:43 am, Guido van Rossum wrote:
The biggest difference is that the `|` operator is no longer symmetrical (since if you have alternatives `A | B`, and both match at some point in the input, PEG reports A, while the old generator would reject the grammar as being ambiguous.
I'm still inclined to think that allowing ambiguous grammars is more of a bug than a feature. Is there some way the generator could be made to at least warn if the grammar is genuinely ambiguous (as opposed to just having overlapping first sets in alternatives)?
We don't specify how other implementations must parse the language
And this is one of the reasons. If we use a PEG grammar as the definition of the language, and aren't careful about ambiguities when we add new syntax, we might accidentally end up with something that can *only* be parsed with a PEG parser or something equally powerful.
I'm sure there will be other ways to parse the same language.
That's certainly true now, but can you be sure it will remain true if additions are made that rely on the full power of PEG? -- Greg