ToCNF
ToCNF
algorithm seems to handle the removal of epsilon-rules and unit-rules from the grammar, when the input is CFG
or EpsilonFreeCFG
.
Should this algorithm even perform this? I think we should consider checking for valid grammar structure and then either throw an exception or convert to CNF. Do not invoke both (see for example AutomatonComplement
and Total
).