S → aAb
A → b
Solution:
Generally, we start to check the given grammar from Context-Free Grammar level, because if it is Context-Free Grammar(CFG) then we know it is obviously Context Sensitive Grammar and Unrestricted Grammar also.
If the given production is not Context-Free Grammar somehow then we go for Context Sensitive Grammar.
But if the given production is Context-Free Grammar then we will check this grammar is Regular Grammar or not because we always check for lower-level grammar to get finest answer.
Now checking CFG for this above grammar:
This grammar S → aAb, 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 production A → b follows the production of regular grammar but S → aAb 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 → aAb this production is neither left linear or right linear.
There is no such production at Regular Grammar: V → T*VT*
Answer: So, the closest answer is this grammar is Context-Free Grammar.