3 ms·
BNF doesn't make something unambiguous. I mean, Foo = "hello" / "hello" is totally acceptable, and if you have any indirection like Foo = XXX / YYY with XXX, Y
by gsnedders 10y ago
BNF doesn't make something unambiguous.
I mean, Foo = "hello" / "hello" is totally acceptable, and if you have any indirection like Foo = XXX / YYY with XXX, YYY = "hello" you can then attach different semantics to XXX and YYY despite it being ambiguous. Add in more levels of indirection, and you have a lower chance of it being trivially obvious.
- legulere 10y agoBut there exist tools to help you decide wether a grammar is unambiguous when you have a formal grammar: https://en.wikipedia.org/wiki/Ambiguous_grammar#Recognizing_ambiguous_grammars https://en.wikipedia.org/wiki/Ambiguous_grammar#Recognizing_...