Remove unit productions from the following CFG:
S0 --> S
S --> ASA | aB | a | SA | AS | S
A-->B | S
B --> b
Solution:
if I replace S with its Right Side part, i get
S0-> ASA | aB | a | SA | AS | S
S --> ASA | aB | a | SA | AS | S
A-->b | ASA | aB | a | SA | AS | S
B --> b
How to remove this S from RHS, S->S or S0->S or A->S all are unit productions.