I want to create a DCG that languages like this get accepted:
- c
- bbbcbbb
- bbacbba
- abacaba
- aababacaababa
As you can see this means that there is a specific order of a and b, then one c and then again the exact same order as before the c. If these conditions are not met it shall fail.
I am currently here with my approach (works, but also recognizes wrong words)
s --> x, s, x.
s --> [c].
x --> [a].
x --> [b].
Can someone of you help me out what I need to change? I don't know how to go on. Thanks a lot.
phrase(s, L).
– Fructidor