S → ASB | ab | SS
A → aA | ε
B → bB | ε
Asked
Active
Viewed 355 times
-3
-
2I'm voting to close this as off-topic because it has nothing to do with programming. – Mephy Nov 08 '15 at 21:29
-
I'm voting to close this question as off-topic because this is not a “do my homework (for free)” site. – lxg Nov 08 '15 at 21:31
-
`S->SS` is always ambiguous (unless there is no other production for `S`, in which case it is useless). It's worth figuring out why that's true. – rici Nov 09 '15 at 01:49
1 Answers
-1
You can get the word "ab" by two ways: S -> ab or S -> SS -> aAS -> aS -> abB -> ab
This is why your grammar is ambigous :)

leo
- 19
- 1
- 5