FOR FREE YEAR SOLVED

IDENTIFY LANGUAGE FROM GRAMMAR

 

Example 6Construct the language generated from the given grammar

G1 = ({S, A, B}, {a, b}, {S}, {P})

P:  S → AB

     B → aBb | λ

     A → aA | λ   

 

Solutions:

From this production B → aBb | λ , we can get an bn | n  0 and A → aA | λ will give you a*. 

 

 From B → aBb | λ  here we get  B  an bn | n  0         

 From A → aA | λ  here we get   A → a*

If we apply both A and B at starting production S then,

S  AB  a*an bn | n  0  [Replace A by a* and B by  an bn | n  0]  

 

because a* maybe λ, a, aa ..  so for a*, m ≥ n 

This range m ≥ n because if