Normal Form of CFG

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.

  • A→BCA \rightarrow BC or
  • A→aA \rightarrow a

CFG to CNF Converstion

  • If start symbol SS occurs in the RHS of some production rule,
    • add S′S' as the start symbol
    • add a production rule S′→SS'\rightarrow S
  • Remove Λ-productions
  • Remove unit productions
  • Remove long productions by using new non-terminals
    For a production rule A→B1B2B3…BnA\rightarrow B_1B_2B_3\dots B_n, replace it with A→B1CA\rightarrow B_1C and C→B2B3…BnC\rightarrow B_2B_3\dots B_n. Do this repeatedly until all long productions are removed.
  • For production rules of the form A→aBA\rightarrow aB
    Replace it with A→XBA\rightarrow XB and a new production rule X→aX\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: A→aA1A2⋯AnA\to aA_{1}A_{2}\cdots A_{n}

Written by September 29, 2026 1 min read
Was this helpful?