You are on page 1of 7

CHOMSKY NORMAL FORM

John Francis T. Olivo


Prince Julius T. Hari

BSCS 2-4

Prof. Ria A. Sagum


COSC 3083 Automata and Language Theory
Normal Forms of
Context-Free Grammars
These are grammars that include restrictions in
the forms of the productions.

There are two normal forms of Normal Forms for CFG

GREIBACH NORMAL FORM

CHOMSKY NORMAL FORM


Chomsky Normal Form
Every rule in the grammar has the following form:

A BC where the RHS contains ONLY two non-terminal symbols

Aa where the RHS contains ONLY a terminal symbol

where A, B, C are non-terminals and a is a terminal.

is not allowed unless it is a start symbol.

S
Theorem
(Chomsky Normal Form, or CNF)
Any context-free language without Any language generated by a CFG
empty () is generated by a grammar in which is called a CFL (Context-Free
is in the form A BC or A a. Language)

or

Every context-free language can be


generated by a grammar in Chomsky
Normal Form.

or

For every CFG, there is an equivalent Two grammars are equivalent if and only if
Chomsky Normal Form they produce or generate the same language.
Algorithm for
Conversion of CFG to CNF
Step 1 Check if the start symbol appears on the RHS
of the production. If so, make a new start
symbol

Step 2 Remove all empty productions, A

Step 3 Remove all unit productions, A B

Step 4 Remove all productions with more than two


symbols on the RHS

Step 5 Ensure that the grammar is in the form

A BC
Aa
Examples

You might also like