Identity the language generated by following grammar where S is the start variable.
S --> XY X --> aX | a Y --> aYb | ∈
(A) {am bn| m>=n, n>0 }
(B) {am bn| m>=n, n>=0 }
(C) {am bn| m>n, n>=0 }
(D) {am bn| m>n, n>0 }
Answer: (C)
Explanation:
S --> XY X --> aX | a // This produces only "a" Y --> aYb | ∈ // This produces and "a" for every "b"
Option (A) and (B) are wrong because n can be zero also
due to epsilon in Y
Option (D) is wrong because Y–>aYb produces equal number of a’s and b’s.
Since there is one variable X which produces at least one a.
Therefore numbers of a’s are always greater than numbers of b’s.
Quiz of this Question