I've searched and searched and can't find a similar CFG. I've got this language:
$$L=\{a^nb^mc^rd^t:n+m=r+t\}$$
Basically, I have to have the same amount of $a$'s and $b$'s as I have $c$'s and $d$'s. I've gotten close, but the production rules I've come up with don't take into consideration the order. i.e. $badc$ is not a valid string in the language. The $a$'s must come before the $b$'s and the $c$'s before the $d$'s.
Any help would be greatly appreciated.
PS Sorry I don't know how to use the math formatting.
HINT: I’ll get you started with the productions $S\to aSd$, $S\to aXc$, $S\to bYd$, and $S\to bZc$. The first lets you generate strings of the form $a^nSd^n$; if you then apply the third, say, you get $a^nbYd^{n+1}$. Now you may want $Y$ to pop out matched $b$s and $d$s, so you want a production $Y\to bYd$; with that you can get strings of the form $a^nb^mYd^{n+m}$. At some point, though, you’ll want to be able to switch to popping out $b$s and $c$s, so you’ll want a production $Y\to bZc$. (We might as well use $Z$ again, since it’s already set up for the purpose.) Can you see how to fill in the details and add the necessary productions to get what you want? There’s still quite a bit to be done, but I think that I’ve at least suggested all of the necessary ideas.