Back to the 2021 paper

Module 1: Introduction & Regular Languages

20217m

Tabulate the Chomsky hierarchy of grammars with an example for each.

Worked SolutionAI Assisted

Answer

Chomsky Hierarchy of Grammars

Type Grammar Name Production Form α→β\alpha \rightarrow \beta Language Class Automaton
Type-0 Unrestricted No restriction on α,β\alpha,\beta (except $\alpha
eq \epsilon$) Recursively Enumerable (RE) Turing Machine
Type-1 Context-Sensitive ∣α∣≤∣β∣|\alpha| \le |\beta|, β\beta has α\alpha in context Context-Sensitive (CSL) Linear Bounded Automaton
Type-2 Context-Free A→γA \rightarrow \gamma, A∈VA \in V, γ∈(V∪T)∗\gamma \in (V \cup T)^* Context-Free (CFL) Pushdown Automaton (PDA)
Type-3 Regular / Right-Linear A→aB∣aA \rightarrow aB \mid a (or left-linear) Regular (REG) Finite Automaton (DFA/NFA)

Examples

Type Example Grammar Language Generated
Type-0 S→aSb∣ϵS \rightarrow aSb \mid \epsilon with unrestricted rules e.g. aB→BaaB \rightarrow Ba {anbncn∣n≥0}\{a^n b^n c^n \mid n\ge0\} or any computable language
Type-1 S→aBC∣aSBCS \rightarrow aBC \mid aSBC, CB→BCCB \rightarrow BC, aB→abaB \rightarrow ab, bB→bbbB \rightarrow bb, bC→bcbC \rightarrow bc, cC→cccC \rightarrow cc {anbncn∣n≥1}\{a^n b^n c^n \mid n\ge1\}
Type-2 S→aSb∣SS∣ϵS \rightarrow aSb \mid SS \mid \epsilon {w∣#a(w)=#b(w)}\{w \mid \#_a(w) = \#_b(w)\} (balanced parentheses)
Type-2 S→(S)∣SS∣ϵS \rightarrow (S) \mid SS \mid \epsilon Balanced parentheses language
Type-3 S→0S∣1S∣ϵS \rightarrow 0S \mid 1S \mid \epsilon {0,1}∗\{0,1\}^* (all binary strings)
Type-3 S→aS∣bAS \rightarrow aS \mid bA, A→bA∣bA \rightarrow bA \mid b {ambn∣m,n≥1}\{a^m b^n \mid m,n\ge1\} (right-linear)

Containment Relations

REG⊂DCFL⊂CFL⊂CSL⊂RE⊂ALL \text{REG} \subset \text{DCFL} \subset \text{CFL} \subset \text{CSL} \subset \text{RE} \subset \text{ALL}

Each level strictly contained in the next (proper subsets).

Notes

  • Type-0 = RE = recognized by TM; not all decidable.
  • Type-1 = CSL = decided by LBA (PSPACE-complete membership).
  • Type-2 = CFL = parsed in O(n3)O(n^3) (CYK); inherently ambiguous CFLs exist.
  • Type-3 = REG = recognized by FA/DFA; all decidable properties.

Final Answer

Table above summarizes all four Chomsky types with production forms, language classes, automata, and concrete grammar examples.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.