How to simplify this context-free grammar into a similar one with no unit productions and no useless symbols?

$$ S \to ABA \\ A \to aAA \mid aBC \mid bB \\ B \to A \mid bB \mid Cb \\ C \to CC \mid cC $$

Can the simplification result in this CFG?

$$ S \to ABA \\ A \to aAA \\ A \to Bb \\ B \to b $$

  • $\begingroup$ The first grammar can produce a $c$… $\endgroup$ – greybeard Jun 26 '20 at 22:30

The context free language at the top seems to be empty, as there always will be a variable at any time while trying to derive a word! (this is because every transition is from a variable to some a few letters and at least one variable)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.