CFGs with standardized production rules.
Chomsky Normal Form
Aka. CNF. Named after Noam Chomsky.
A CFG is in CNF iff all productions of has either 1 terminal or 2 non-terminals in RHS.
- or
CFG to CNF Converstion
- If start symbol occurs in the RHS of some production rule,
- add as the start symbol
- add a production rule
- Remove Λ-productions
- Remove unit productions
- Remove long productions by using new non-terminals
For a production rule , replace it with and . Do this repeatedly until all long productions are removed. - For production rules of the form
- Replace it with and a new production rule
Greibach’s Normal Form
Aka. GNF. Named after Sheila Greibach.
A CFG is in GNF iff all productions are of the form: