0% found this document useful (0 votes)
26 views1 page

Chomsky Hierarchy

Uploaded by

Akshit Bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

Chomsky Hierarchy

Uploaded by

Akshit Bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Chomsky Hierarchy

The Chomsky Hierarchy is a classification of formal grammars that was introduced by Noam
Chomsky in the 1950s. It categorizes grammars based on their generative power and the
types of languages they can generate. The hierarchy consists of four types of grammars:
Type-0, Type-1, Type-2, and Type-3. Each type has distinct characteristics and is associated
with different classes of formal languages, ranging from the most general to the most
restrictive. This document will explain each type of grammar and highlight the differences
between them.

Chomsky Hierarchy of Grammars

Type-0 Grammars

Type-1 Grammars

Type-2 Grammars

Type-3 Grammars

Type-0
Type-1
Recursively Enumerable
Context-Sensitive Languages
Languages
Linear Bounded Automata
Unrestricted Grammars
Chomsky
Hierarchy Type-2
Type-3
Context-Free Languages
Regular Languages
Pushdown Automata
Finite Automata

Type-0 Grammars (Recursively Enumerable


Languages)
Type-0 grammars, also known as unrestricted grammars, are the most general class in the
Chomsky Hierarchy. They do not impose any restrictions on their production rules, which can
be of the form:

α→β

where α and β are strings of terminals and non-terminals, and α must contain at least
one non-terminal. Type-0 grammars can generate recursively enumerable languages,
which means that there exists a Turing machine that can recognize these languages.
However, they may not always halt, making them non-decidable.

Characteristics:
• No restrictions on production rules.
• Can generate any language that a Turing machine can recognize.
• Non-decidable languages.

Type-1 Grammars (Context-Sensitive Languages)

Type-1 grammars, or context-sensitive grammars, impose some restrictions on their


production rules. The rules are of the form:

αAβ → αγβ

where A is a non-terminal, and α, β, and γ are strings of terminals and non-terminals. The
key restriction is that the length of the string on the left-hand side must be less than or
equal to the length of the string on the right-hand side. Type-1 grammars can generate
context-sensitive languages, which can be recognized by linear-bounded automata.

Characteristics:
• Production rules must maintain or increase string length.
• Can generate context-sensitive languages.
• Recognized by linear-bounded automata.

Type-2 Grammars (Context-Free Languages)

Type-2 grammars, or context-free grammars, have even more restrictions on their production
rules. The rules are of the form:

A →β

where A is a single non-terminal and β is a string of terminals and non-terminals. These


grammars can generate context-free languages, which can be recognized by pushdown
automata. Context-free languages are widely used in programming languages and
natural language processing.

Characteristics:
• Production rules consist of a single non-terminal on the left-hand side.
• Can generate context-free languages.
• Recognized by pushdown automata.

Type-3 Grammars (Regular Languages)

Type-3 grammars, or regular grammars, are the most restrictive class in the Chomsky
Hierarchy. The production rules can be of the form:

A → aB
A→a

where A and B are non-terminals and a is a terminal. Regular grammars can generate regular
languages, which can be recognized by finite automata. Regular languages are the simplest
class of languages and are commonly used in lexical analysis and pattern matching.

Characteristics:
• Production rules are highly restricted (right-linear or left-linear).
• Can generate regular languages.
• Recognized by finite automata.

Differentiation Between the Types

Type-0 Type-1

Production Rules: α → β Production Rules: αAβ → αγβ


Recognized By: Turing Machine Recognized By: Linear-Bounded
Automaton
Language Class: Recursively
Enumerable Language Class: Context-Sensitive
Chomsky
Type-3 Hierarchy Type-2

Production Rules: A → aB or A → Production Rules: A → β


a
Recognized By: Pushdown
Recognized By: Finite Automaton Automaton
Language Class: Regular Language Class: Context-Free

You might also like