# Generate the context free grammar for the following language: $\left \{ a^{3n}b^{m}c^{n}|n>0, m>0\right \}$

Given the following language, I am tasked with giving a context-free grammar that generates it.

$$\left \{ a^{3n}b^{m}c^{n}|n>0, m>0\right \}$$

Would this be correct?

$$A \rightarrow aaaA$$
$$B\rightarrow Bb | b$$
$$C\rightarrow Cc|c$$
$$S\rightarrow ASBSCS|\epsilon$$

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher.
– D.W.
Nov 19 '20 at 19:26

Unfortunately your grammar generates only $$\epsilon$$ (which is not in the language, since $$n$$ and $$m$$ are greater than 0), as you don't delete the $$A$$; moreover you don't control that the number of $$A$$'s is thrice the numeber of $$C$$'s.
$$S\rightarrow aaaS'c$$
$$S' \rightarrow aaaS'c | B$$
$$B\rightarrow Bb | b$$