S → AB
A → a
B → b
Now checking CFG for this above grammar:
This grammar S → AB, A → a, B → 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, B)
As we know the production rule of CFG: V → (V ∪ T)*
Now checking for Regular Grammar:
This production A → b and B → b are follow the production of regular grammar but S → AB does not follow the basic production rule of Regular Grammar.
As know the production rule of Regular Grammar:
V → T* | T*V (Right linear)
V → T* | VT* (Left linear)
So, S → AB production is neither left linear or right linear.
There is no such production at Regular Grammar: V → VV
So, this grammar is Context-Free Grammar and because of this grammar is Context Free Grammar, it is Context Sensitive Grammar and Unrestricted Grammar also but we always take the closest grammar or the smallest subset of grammar family as an answer.
Answer: This grammar is Context-Free Grammar.