1

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.

  • make sure you add a $c$ every time you add an $a$ or $b$ then you already have $p+q = r$, then ensure we have at least one $a$ or $b$ more than that. – Henno Brandsma Mar 09 '21 at 10:22

0 Answers0