S → aA
A → b
Now checking CFG for this above grammar:
This grammar S → aA, A → b is CFG grammar because left-hand side of both production has only one variable (no context).
As we know the production rule of CFG: V → (V ∪ T)*
Now checking for Regular Grammar:
This both production S → aA, A → b 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 → b (V → T*).
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.
Some other example of Regular Grammar:
A → aab – (V → T* | T*V)
A → a – (V → T | TV)
→ aB – (V → T | TV)