Define a grammar for language $L = \{a^{n}b^{*}c^{2n+1} \}$

66 Views Asked by At

could someone please help me define grammar for given language (or help me to improve mine): $L = \{a^{n}b^{*}c^{2n+1} | n >= 1\}$

this is what I have so far, but it is not correct: $$S → aSc$$ $$S → BC$$ $$B → bB$$ $$B → ε$$ $$C → cC$$ $$C → ε$$

1

There are 1 best solutions below

0
On BEST ANSWER

How about:
$S \rightarrow Ac$
$A \rightarrow aBc^2$
$B \rightarrow aBc^2$
$B \rightarrow \epsilon$
$B \rightarrow Cb$
$C \rightarrow Cb$
$C \rightarrow \epsilon$