On 3/04/20 3:22 pm, Guido van Rossum wrote:
This allows more freedom in designing a grammar. For example, it would let a language designer solve the "dangling else" problem from the Wikipedia page, by writing the form including the "else" clause first .
I'm inclined to think that such problems shouldn't be solved at the parser level, but rather at the language level, i.e. don't design the language that way in the first place. After all, if it's confusing to the computer, it's probably going to be confusing to humans as well.
(I note that all of Wirth's languages after Pascal changed the syntax so as not to have a dangling else problem.)
Personally I would rather my parser generator *did* complain about ambiguities, so that I can facepalm myself for designing my language in such a stupid way.