You are on page 1of 12

The Chomsky Hierarchy

23-04-2021 Dept. of CSE 1


Who is Noam Chomsky?
• Philosopher of Languages
• Professor of Linguistics at MIT
• Constructed the idea that language was not a learned “behavior”, but
that it was cognitive and innate; versus stimulus-response driven
• In an effort to explain these theories, he developed the Chomsky
Hierarchy

23-04-2021 Dept. of CSE 2


Chomsky Hierarchy
LRE

LCSG

LCFG

23-04-2021 Dept. of CSE 3


Type-0 (Unrestricted Grammar)
Definition:
A Grammar G = (V, Σ , S, P), V∩Σ = ɸ is of type-0, if the productions have the form
α→β
For α ∈ (V U Σ)*V(V U Σ)*, β ∈ (V U Σ)*

A language L is type-0 if and only if there is a type-0 grammar G such that L(G) = L

Example:
G = (V, Σ , S, P) where
P = {S→XA, A→ AB|b, bB→Bbb, XB→X, X→ ∈}

Language: Machine:
Recursively enumerable language Turing Machine
23-04-2021 Dept. of CSE 4
Type-1 (Context Sensitive Grammar)
Definition:
A Grammar G = (V, Σ , S, P), V∩Σ = ɸ is of type-1, if the productions have the form
α→β
For α ∈ (V U Σ)*V(V U Σ)*, β ∈ (V U Σ)*, |α| < |β|

Example:
G = (V, Σ , S, P) where
P = {S→aSBC | abC, CB→DB, DB→DE, DE→DC, DC→BC, bB→bb, C→c }

Language: Machine:
Context Sensitive language Linear bound automata
23-04-2021 Dept. of CSE 5
Type-2 (Context Free Grammar)
Definition:
A Grammar G = (V, Σ , S, P), V∩Σ = ɸ is of type-2, if the productions have the form
A→β
For A ∈ V, β ∈ (V U Σ)*

A language L is type-2 if and only if there is a type-2 grammar G such that L(G) = L

Example:
G = (V, Σ , S, P) where
P = {S→aSb | ∈}

Language: Machine:
Context Free Language Push down automata
23-04-2021 Dept. of CSE 6
Type-3 (Regular Grammar)
Definition:
A Grammar G = (V, Σ , S, P), V∩Σ = ɸ is of type-3 or right linear or left linear, if the productions have the
form
A → xB | x (or) A → Bx | x
For A, B ∈ V, x ∈ Σ*

A language L is type-2 if and only if there is a type-2 grammar G such that L(G) = L

Example:
G = (V, Σ , S, P) where
P = {S→aS | ∈}

Language: Machine:
Regular Language Finite automata
23-04-2021 Dept. of CSE 7
Chomsky Hierarchy

LRE
• All Language accepted by Finite
Automata are recognized by
LCSG
PDA & TM
• Language accepted by TM need
LCFG
not be accepted by Finite
automata

23-04-2021 Dept. of CSE 8


Chomsky Hierarchy

23-04-2021 Dept. of CSE 9


Relationship between regular, linear, deterministic context-free, and nondeterministic
context-free languages

23-04-2021 Dept. of CSE 10


Summary
Type Grammar Syntax Language Machine Storage Unit
Type-0 Unrestricted α → β Recursively Turing Tape
grammar α ∈ (V U Σ)*V(V U enumerable machine
Σ)*, language
β ∈ (V U Σ)*
Type-1 Context α→β Context Linear bound Restricted
sensitive α ∈ (V U Σ)*V(V U sensitive automata tape
grammar Σ)*, language
β ∈ (V U Σ)*,
|α| < |β|
Type-2 Context free A → β Context free Push down Stack
grammar A ∈ V, language automata
β ∈ (V U Σ)*
Type-3 Regular A → xB | x (or) Regular Finite Nil
Grammar A → Bx | x language automata
A, B ∈ V,
x ∈ Σ*

23-04-2021 Dept. of CSE 11


Thank You

23-04-2021 Dept. of CSE 12

You might also like