Identify the language generated by the following grammar, where S is the start variable. S → XY X → aX | a Y → aYb | ϵ
Identify the language generated by the following grammar, where S is the start variable. S → XY X → aX | a Y → aYb | ϵ Correct Answer {a<sup>m</sup>b<sup>n</sup> | m > n, n ≥ 0}
Grammar:
S → XY
X → aX | a
Y → aYb | ϵ
Explanation:
X generates at least one a. Generates a string of type {a, aa, aaa, aaaa……}
ambn, if n = 0 and m = 0 ∴ string = ϵ which cannot be generated from the given grammar and hence option 2 is incorrect.
Y generates an equal number of a and b { ϵ, ab, aabb, ……} with a comes before b.
Since at least one a is generated by X and an equal number of a’s and b’s generated by Y ∴ m> n and hence option 1 is incorrect
The smallest length string generated by Y is ϵ. In ambn, n ≥ 0 and hence option 4 is incorrect.
{ a, aab, aaabb,………….} which is equivalent to :
L = {ambn | m > n, n ≥ 0}