I've already attempted it but I am finding it difficult to understand if this is correct.
give a context free grammar for the following:
$$ \{p^{3m+n}q^nr^2p^m\mid m,n\ge 0 \}$$
The answer i've attempted is:
$S \to XY$
$X \to pppXp \mid \ q$
$Y \to qYr \mid \epsilon$
I've been trying to understand if i need to break down: $$ \{p^{3+m+n} \}$$ in to
$$ \{p^{3}p^m p^n \}$$
to give me: pppXp
then q and r would value to
qYr | $\epsilon$