Let $V = \{S, A,B, a, b\}$ and $T = \{a,b\}$. Determine whether $G = (V, T, S, P)$ is a type $0$ grammar but not a type $1$ grammar, a type $1$ grammar but not a type $2$ grammar, or a type $2$ grammar but not a type $3$ grammar if $P$, the set of productions, is
(a) $S \rightarrow aA, A \rightarrow bB, B \rightarrow b, B \rightarrow λ$ .
(b) $S \rightarrow ABA, A \rightarrow aB, B \rightarrow ab$.
Also determine $L(G)$, the for each set of the productions $P$.
Determining what type of grammar you have is just a matter of comparing the forms of the productions with the forms allowed by the definitions of the four types; that’s something that you should at least try to do on your own, though we’ll be happy to check your results.
Determining the language generated by a given grammar can be quite difficult, but these aren’t at all bad. I’ll walk you through the way in which I would approach the question for grammar (b). First, any derivation has to start with an application of the production $S\to ABA$, since it’s the only production with the initial symbol, $S$, on the lefthand side. Now we have the word $ABA$. The only production with $A$ on the lefthand side is $A\to aB$, so let’s apply it to both $A$s:
$$S\to ABA\to aBBA\to aBBaB$$
Now the only non-terminal symbol remaining is $B$, and there’s only one production with $B$ on the lefthand side, so you should have no trouble finishing the derivation and discovering that there is exactly one word in the language generated by this grammar.
You can find the language generated by grammar (a) in the same way; you should find that it consists of exactly two words.