Chomsky Hierarchy in Theory of Computation

Last Updated : 20 Aug, 2026

The Chomsky Hierarchy is a classification of formal languages into four types based on the restrictions of their grammars and the computational power required to recognise them. It covers all language types, from regular languages (Type 3) with the simplest grammar to recursively enumerable languages (Type 0) with the most complex grammar.

file
Chomsky Hierarchy

According to the Chomsky hierarchy, grammar is divided into 4 types as follows: 

  1. Type 0 is known as unrestricted grammar.
  2. Type 1 is known as context-sensitive grammar.
  3. Type 2 is known as a context-free grammar.
  4. Type 3 Regular Grammar.

Type 0: Unrestricted Grammar: 

Type-0 grammars include all formal grammar. Type 0 grammar languages are recognized by turing machine. These languages are also known as the Recursively Enumerable languages. 

Grammar Production in the form of   \alpha \rightarrow \beta where 

\alpha \in (V \cup T)^* V (V \cup T)^*

Where,

  • V : Variables 
  • T : Terminals
\beta \in (V \cup T)^*

In type 0 there must be at least one variable on the Left side of production. 

For example: 

Sab → ba
A → S

Here, Variables are S, A and Terminals a, b. 

Type 1: Context-Sensitive Grammar

Type-1 grammars generate context-sensitive languages. The language generated by the grammar is recognized by the Linear Bounded Automata (LBA).

In Type 1,

  • Every Type-1 grammar is also a Type-0 grammar, with additional non-contracting restrictions.
  • Grammar Production in the form of 
\alpha \rightarrow \beta, where
|\alpha| \leq |\beta|

This means that the length of α must be less than or equal to the length of β. Therefore, Type-1 grammars are also called non-contracting grammars.

\alpha, \beta \in (V \cup T)^+

Here, α must contain at least one variable (non-terminal), and β must be non-empty.

Note: Type-1 grammars generally do not allow ε-productions. However, the start symbol may produce ε (S → ε) as a special case, provided that S does not occur on the right-hand side of any production.
  
For Example:

S --> AB
AB --> abc 
B --> b  

Here:

  • S, A, B are variables.
  • a, b, c are terminals.
  • |S| = 1 \leq |AB| = 2
  • |AB| = 2 \leq |abc| = 3
  • |B| = 1 \leq |b| = 1
  • Hence, all productions satisfy the non-contracting condition.

Type 2: Context-Free Grammar: Type-2 grammars generate context-free languages. The language generated by the grammar is recognized by a Pushdown automata

In Type 2:

  • Every Type-2 grammar is also a Type-1 grammar, with the additional restriction that the left-hand side contains exactly one variable.
  • The left-hand side of every production contains exactly one variable, while the right-hand side can be any string of terminals and variables, including ε.

|\alpha| = 1.  

For example:

S --> AB 
A --> a 
B --> b 

Type 3: Regular 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 3 should be in the given form only : 

V --> VT / T          (left-regular grammar)
(or)
V --> TV /T (right-regular grammar)

For example:

S --> a

The above form is called strictly regular grammar.

There is another form of regular grammar called extended regular grammar. In this form:

V --> VT* / T*.        (Extended left-regular grammar)
(or) 
V --> T*V /T*  (Extended right-regular grammar)

For example : 

S --> ab. 
Comment

Explore