See Explanation Below
Explanation:
Given
S → aSb | bY | Y a
Y → bY | aY | ε
Giving a simple description of L(G) in English. The description is as follows;
This means that L(G) contains a string of a's and b's such that the following are true;
1. the string starts with n a’s and m b’s, where n and m can be zero, but not at the same time,and at least one of option 2 and option 3
2. and has any number of a’s or b’s followed by an a
3. ab followed by any number of a’s and b’s
Note that n and m represent numerical digits
Using the description to give a CFG for L(G), the complement of L(G) is written as L'(G)
L'G are elements not in L(G) and they are
L'(G) =a^n b (a∪b) * b^n ∪ a^n (a∪b) * ab^n