S -> aA | bC | CC | a | b | C A -> B B -> S C -> A | S
It looks like its going to loop so it would be endless replacing the unit rule....
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
You can always eliminate unit rules. In fact, every context-free grammar can be massaged to one in Chomsky normal form, and there are several algorithms doing that. Their treatment of unit rules is more subtle than what you suggest.