I have several BNF defined as follow:
1. -> 0 | 1 | 0
2. -> 1 | 1 | 0
3. -> 0 | 1 | 1 | 0
4. -> 0 | 1 | 0
5. -> 1 | 0
This is the solution from my friend, however, I doubt the correctness of some of them
1. { 0^n: n >= 1 } V { 0^n1: n >= 0 } -> This is fine.
2. { 1^n0^k: n > 0, k = 0, 1 } -> I don't quite get this one, is the same with grammar 1?
3. { 0 } V { 1^n0^k: n > 0 and k = 0, 1 } -> I think this one is incorrect.
4. { 0^n: n > 0 } V { 10^n: n >= 0 } -> I think this is also incorrect
5. { 01^n: n >= 0 } -> This is fine.
Could anyone help me explain this?
Thanks,
Chan