Date post: | 18-Jan-2016 |
Category: |
Documents |
Upload: | eduardo-tavara |
View: | 37 times |
Download: | 0 times |
6.2 TWO IMPORTANT NORMAL FORMS
CHOMSKY NORMAL FORM GREIBACH NORMAL FORM
Edith Castro
March 27, 2014
Chomsky Normal Form
A context-free grammar is in Chomsky normal form if all productions are of the form:
A BC or A a
Where: A, B, C are variables and a is a terminal symbol.
Example 1:
Given the grammar: P: S AS | a,
A SA | b
The productions are of the Chomsky normal form.
2
Chomsky Normal FormExample 2:
Given another grammar:
P: S AS | AAS,
A SA | aa
The productions S AAS and A aa do not follow the conditions of the Chomsky normal form. The grammar is not in the Chomsky normal form.
3
Chomsky Normal Form
4
Chomsky Normal Form
5
Chomsky Normal Form
6
Chomsky Normal Form
7
Chomsky Normal Form
Example: Given the grammar with the productions:
S ABa, A aab,B Ac
Convert to Chomsky normal form.
Solution: We can apply the theorem 6.6. So the grammar does not have any - productions and no unit-productions.
8
Chomsky Normal Form
9
Chomsky Normal FormStep 1: We introduce additional variables to get the first two productions into normal form and we get the final result:
10
11
12
13
14
15
16
17
18
19
20
21
22