-
Consider the following statements about the context-free grammar:
G = { S → SS, S → ab, S → ba, S → ∈ }
1. G is ambiguous.
2. G produces all strings with equal number of a's and b's.
3. G can be accepted by a deterministic PDA.
Which combination below expresses all the true statements about G?
-
- 1 only
- 1 and 3
- 2 and 3
- 1, 2 and 3
- 1 only
Correct Option: B
Due to S → S this Grammar is ambiguous right hand side has two Non terminals. Also the strings like aaabbb have equal no. of a's & b's but can't be produced by this grammar. So 2 is false.
Statement 3 is true since it is a CFG so accepted by PDA.