What type of grammar is this, and what type of language does it generate?

55 Views Asked by At

Notation seems to vary a bit on here, so for this question:

$N$ is the set of nonterminals $\{S, A\}$,

$T$ is the set of terminals $\{a, b, c\}$

$P$ is the set of productions $u \rightarrow v$.

I have to determine the type of grammar of $G$, for $G = (\{S, A\}, \{a, b, c\}, S, \{S \rightarrow Sc, S \rightarrow Ac, A \rightarrow ab, A \rightarrow aAb\}$).

I think it is a linear grammar. I know that for a linear grammar, each $u \rightarrow v \in P$ has $u \in N$ and $v \in T^{*} \cup T^{*}NT^{*}.$

The left side of each production is a nonterminal, so that's okay. I just have to check the right side:

$Sc = \lambda Sc \in T^{*}NT^{*}$,

$Ac = \lambda Ac \in T^{*}NT^{*}$,

$ab \in T^{*}$,

$aAb = T^{*}NT^{*}$.

Since each $v$ is in either the set $T^{*}$ or $T^{*}NT^{*}$, I think this is a linear grammar that generates a linear language.

Is there anything about this that is incorrect? I just started studying grammars and I want to make sure I am understanding it. Please advise!

1

There are 1 best solutions below

1
On

The language is $L = \{a^nb^nc^m\mid m,n\geq 1\}$. This language is contextfree not regular. It can be proved by the pumping lemma.