What is the grammar for language $L = \{ a^nb^m : n!=m-1\}$?
I only know I have to write grammar for both $ n<m-1 $ and $ n>m-1 $, so this is what I wrote:
for n<m-1
S->Abb
A->aAb|landa
for n>m-1
S->aaA
A->aAb|landa
Yet I can not mix them and get a correct grammer for it.