First of all this grammar is right linear. And we know:
Two special types of linear grammars are the following:
- the left-linear or left regular grammars, in which all nonterminals in right hand sides are at the left ends;
- the right-linear or right regular grammars, in which all nonterminals in right hand sides are at the right ends.
Hence the given grammar is regular and hence the language generated by regular grammar will also be regular. Alternatively we can also write a regular expression for it. Let us see how to do it:
Given grammar:
$G:$ $S\rightarrow aB$
$B \rightarrow bC$
$C\rightarrow xB \mid c$
So, we can reverse substitution from $C$ onwards to $S$ to see what $S$ generates..
Substituting the yield of $C$ in $B$, we have:
$B \rightarrow bxB \mid bc$
which gives $B = (bx)^* bc$
Now, substituting $B$ in $S$ we have:
$\mathbf{S \rightarrow aB}$
$\mathbf{S = a(bx)^*bc}$
Hence, the corresponding regular expression is : $\mathbf{a(bx)^*bc}$