FOR FREE CONTENT

IDENTIFY THE GRAMMAR

 

           S → aA | Aa 

           A → b

 

Solution:

Now checking CFG for this above grammar:

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

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

 

Now checking for Regular Grammar:

This production A → b follows the production of regular grammar but S → aA | Aa does not follow the basic production rules of Regular Grammar.           

 

As know the production rules of Regular Grammar:

 

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

V → T* | VT*    (Left linear)   

 

Regular Grammar either content left linear or right linear at the same production but not both at a time.

 

So, S → aA | Aa, here left linear and right linear together at the same production.

There is no such production at Regular Grammar: V → VT* | T*V  

So, this grammar is not Regular Grammar

Answer: This grammar is Context-Free Grammar

 

Note: Every Regular Language there exists at least one regular grammar. It is not like that a regular language has all with regular grammar, maybe some non-regular grammar in at regular language.