3 ms·
exactly. People like to pretend that e.g. PEG grammars don't have ambiguities because of "ordered choice"... But the truth is, they simply mask ambiguity away!
by tomp 11y ago
exactly. People like to pretend that e.g. PEG grammars don't have ambiguities because of "ordered choice"... But the truth is, they simply mask ambiguity away! Even yacc will always produce a valid grammar, resolving conflicts in a well-defined manner - while also letting you know how to fix your grammar to make it even better!
Edit: this is actually explained much better in the article.
- sklogic 11y ago> But the truth is, they simply mask ambiguity away! Incorrect. The choice is explicit. Ambiguity gone, period. If the order makes some of the branches unreachable, it can be easily statically proven. In practice this is more than enough and does not require nearly as much effort as all the other parsing approaches.