Example 3: Construct the language generated from the given grammar
G = ({S, A}, {a, b}, {S}, {P})
P: S → Ab
A → aAb | λ
Solutions:
P: S → Ab
A → aAb | λ an bn | n ≥ 0 [For details see example 1]
From production A → aAb | λ, we will get an bn | n ≥ 0
Then,
A → an bn | n ≥ 0
S → an bn b | n ≥ 0 [We replace A by an bn | n ≥ 0 at production S → Ab]
S → an bn+1 | n ≥ 0
Follow the next examples: