FOR FREE YEAR SOLVED

IDENTIFY THE GRAMMAR

 

           A →  aA | λ

 

Solution:

Now checking CFG for this above grammar:

This grammar S → aA, S → λ is CFG grammar because left hand side of both production S has only one variable (no context at the left hand and right-hand side of S).

As we know the production rule of CFG:  V → (V ∪ T)* 

 

Now checking for Regular Grammar:

This both production S → aA, A → λ follows the production rule of regular grammar.

 

As know the production rule of Regular Grammar: 

 

V → T* | T*V    (Right linear)

V → T* | VT*    (Left linear)   

 

S →  aA (V → T*V) is right linear and A → λ (V → T*)    [T* contains λ]

So, the above grammar is Context-Free Grammar and Regular Grammar but we always take the closest subset of grammar (exact grammar).

Answer: This grammar is Regular Grammar.