Is a^mb^n
m repetitions of a
followed by n repetitions of b
? It looks like you copy-pasted an assignment and neglected even to format it to be readable on this site.
Assuming I'm reading that correctly, moving on…
The key is that (in the first language) b
and c
are repeated an equal number of times. When you match a b
you must simultaneously match a c
. A production matching this subsequence would be
S1 => e
S1 => b S1 c
Note that there are two languages there so you need two answers. You aren't being asked for one grammar that handles both languages. (The main problem with that would be ambiguity in the case that n = m).