Normal Form of CFG

1 min read Updated Fri Apr 24 2026 07:36:29 GMT+0000 (Coordinated Universal Time)

CFGs with standardized production rules.

Chomsky Normal Form

Aka. CNF. Named after Noam Chomsky.

A CFG GG is in CNF iff all productions of GG has either 1 terminal or 2 non-terminals in RHS.

  • ABCA \rightarrow BC or
  • AaA \rightarrow a

CFG to CNF Converstion

  • If start symbol SS occurs in the RHS of some production rule,
    • add SS' as the start symbol
    • add a production rule SSS'\rightarrow S
  • Remove Λ-productions
  • Remove unit productions
  • Remove long productions by using new non-terminals
    For a production rule AB1B2B3BnA\rightarrow B_1B_2B_3\dots B_n, replace it with AB1CA\rightarrow B_1C and CB2B3BnC\rightarrow B_2B_3\dots B_n. Do this repeatedly until all long productions are removed.
  • For production rules of the form AaBA\rightarrow aB
  • Replace it with AXBA\rightarrow XB and a new production rule XaX\rightarrow a

Greibach’s Normal Form

Aka. GNF. Named after Sheila Greibach.

A CFG GG is in GNF iff all productions are of the form: AaA1A2AnA\to aA_{1}A_{2}\cdots A_{n}