How to write a grammar that accepts the language formed by strings $e^{3n} f g^{2n} h$?

40 Views Asked by At

$e^{3n}\: f \: g^{2n}\: h$

n ∈ ℕ∪{0}

For Example:

fh

eeefggh

eeeeeefggggh

I am stuck at the $e^{3n}$ and $g^{2n}$ part. This is what I have so far:

S→EfGh 
E→eE∣ϵ
G→gG∣ϵ

Please correct me if I am wrong. Thanks

1

There are 1 best solutions below

1
On BEST ANSWER

$S\rightarrow Th, \;\; T\rightarrow eeeTgg\;\; T\rightarrow f$.