Chomsky Hierarchy Material
Chomsky Hierarchy Material
1
This is a hierarchy. Therefore every language of type 3 is also of type 2, 1 and 0.
Similarly, every language of type 2 is also of type 1 and type 0, etc
Type 3 Grammar:
Type-3 grammars generate regular languages. These languages are exactly
all languages that can be accepted by a finite-state automaton. Type 3 is
the most restricted form of grammar .
Type 2 Grammar:
Type 2 Grammar is known as Context Free Grammar. Context free languages
are the languages which can be represented by the context free grammar
(CFG). Type 2 should be type 1.
2
1. A → α
Where A is any single non-terminal and is any combination of terminals and non-
terminals
For example:
1. A → aBb
2. A → b
3. B → a
For example:
S --> AB
A --> a
B --> b
3. Type 1 grammar:
These grammars generate context-sensitive languages. These are of the form: α → β, with the
following condition |β| >=|α|,i.e. length of β is greater then length of α.
o The context sensitive grammar may have more than one symbol on
the left hand side of their production rules.
o The number of symbols on the left-hand side must not exceed the
number of symbols on the right-hand side.
o The rule of the form A → ε is not allowed unless A is a start symbol. It
does not occur on the right-hand side of any rule.
o The Type 1 grammar should be Type 0.
For example:
1. S → AT
2. T → xy
3. A → a
3
Type 0 Grammar:
Type 0 grammar is known as Unrestricted grammar. There is no restriction
on the grammar rules of these types of languages. These languages can be
efficiently modeled by Turing machines.
Examples
1. bAa → aa
2. S → s