4 ms·
Nice article! In this sentence ... open parenthesis character is ambiguous in this context. To get around it they made their grammar more ambiguous and then e
by chubot 3y ago
Nice article! In this sentence
... open parenthesis character is ambiguous in this context. To get around it they made their grammar more ambiguous and then enforced that the actual grammar was enforced in their tree builder.
I'd change the second "more ambiguous" to "more lenient"
i.e. lenient meaning "grammar accepts more strings", ambiguous meaning "grammar is invalid"
I have seen this issue in Python's grammar as well, and it's mitigated by the new PEG parser
- awestroke 3y agoAmbigious does not mean invalid
- chubot 3y agoYes, technically it means "there's more than one derivation" But Python's pgen rejects such grammars as invalid ... The other strategy is just to pick an arbitrary interpretation
- hinkley 3y agoFor people who see parsing as model checking, ambiguity means something vastly different (inferior) to leniency. Fast parsers that use a schema are also doing model checking.