Make formal grammar for the language

22 Views Asked by At

I have homework at my university and there is a task which I don't know how to do. I have a language and I should make a grammar which matches the language.

Here's the language $L=\{a^pb^qc^r \mid p + q > r; p, q, r >=0\}$

I know how to do the grammar without the p + q > r requirement (I'm not quite sure though). Here's what I have at the moment:

S --> A | B | C

A --> aA | aB | aC | a

B --> bB | bC | b

C --> cC | c

If someone knows how to satisfy the p + q > r requirement I would be glad to get help.