0

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 Answers1

2

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$

amitb03
  • 131