I’m having a hard time figuring out what is and is not ambiguous in a grammar.
For instance, in the grammar below, the "-" (U+002D HYPHEN MINUS) character alone in the unsescaped_char rule makes the grammar ambiguous and the parser return three results.
I’m having a hard time figuring out what is and is not ambiguous in a grammar.
For instance, in the grammar below, the
"-"
(U+002D HYPHEN MINUS) character alone in theunsescaped_char
rule makes the grammar ambiguous and the parser return three results.Remove the
"-"
and the grammar becomes unambiguous. 🤔This can be seen in this BNF Playground example:
This parses as a unambiguous.
Now, lets add a simple
"-"
(U+002D HYPHEN MINUS) character to theunescaped_char
rule.Now the grammar is ambiguous and the parser returns three results! Am I missing something ?