Here some productions of the grammar are giving and we will recognize which one is Regular Grammar, Context-Free Grammar, Context-Free Grammar, or Unrestricted grammar.

In examination generally, questions asked regarding Regular Grammar, Context-Free Grammar checking.


Important: (This concept is very important to solve the problem regarding grammar identification)

At the time of identification of grammar, we always try to find the finest grammar as a solution means the exact subset of the grammar family.



S → aS | λ

From the above grammar, it is clear that it is a context-free grammar because the left hand of the product S has no left and right context ( i.e. as per CFG at left-hand side of the production nothing will be allowed except a single variable or non-terminal).


Now check the smallest subset of grammar so, check for regular grammar.

This grammar also meets the production rule of regular grammar because of this S → aS | λ right linear grammar. 


As we know the production rules of regular grammar.


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

V → T*|VT*       (Left linear)       


So, this above-given grammar is Regular Grammar.

As we know if the above grammar S → aS | λ is regular then it context free, context sensitive and unrestricted grammar also.


But we always take the finest subset of the grammar family as an answer.

So, the answer should be this grammar S → aS | λ is Regular Grammar.