Succinct grammar to parse strings of alternating characters like “ababa” or “baba”
Now the grammar in my parser looks like that (I omit the surrounding code for sake of brevity):
I guess it is not the most succinct way to describe this grammar. How to make it more compact?
The BNF answer from Filip can be written in my syntax as:
The BNF grammar you have is this:
which I think translates to this using your syntax:
Note that it is important to check terminals (