Chomsky Method in
Theory of Automata and Formal Languages
(TAFL)
Shivam Kumar (59)
Ashmit Sajwan (46)
Shreyas Tiwari (61)
B.Tech in AIML
Submitted to: Dr. Shalini Yadav
Course Instructor – TAFL
Abstract
This project discusses the classification of grammars introduced by Noam Chom-
sky within the subject of Automata and Formal Languages. It explains how formal
languages can be grouped and understood using models such as finite automata
and pushdown automata. The content includes basic definitions, examples, and
their practical uses.
Contents
1 Introduction 2
2 Chomsky Hierarchy 2
3 Formal Grammar 2
4 Grammar and Automata Examples 3
4.1 Regular Grammar (Type 3) . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 Context-Free Grammar (Type 2) . . . . . . . . . . . . . . . . . . . . . . 3
4.3 Context-Sensitive Grammar (Type 1) . . . . . . . . . . . . . . . . . . . . 3
4.4 Unrestricted Grammar (Type 0) . . . . . . . . . . . . . . . . . . . . . . . 4
5 Pushdown Automaton (PDA) Example 4
6 Chomsky Normal Form (CNF) 4
7 Applications 5
8 Conclusion 5
1
KCC Institute of Technology and Management Chomsky Method in TAFL
1 Introduction
The Theory of Automata and Formal Languages (TAFL) helps in understanding the ba-
sic structure of computer science. Noam Chomsky introduced a classification called the
Chomsky Hierarchy, which organizes grammars based on their complexity and computa-
tional ability.
2 Chomsky Hierarchy
The Chomsky hierarchy divides grammars into four main types:
• Type 0: Recursively Enumerable (Unrestricted)
• Type 1: Context-Sensitive
• Type 2: Context-Free
• Type 3: Regular
Figure 1: Chomsky Hierarchy of Grammars
3 Formal Grammar
A formal grammar G = (V, T, P, S) includes:
• V : Non-terminal symbols
• T : Terminal symbols
• P : Production rules
• S : Start symbol
Each grammar type limits the form of rules in P.
2
KCC Institute of Technology and Management Chomsky Method in TAFL
4 Grammar and Automata Examples
4.1 Regular Grammar (Type 3)
Regular grammars are the simplest class of grammars and can be represented using finite
automata.
Example Grammar:
S → aS | bS | ab
This grammar generates strings that end with “ab”.
Example Strings: “ab“, “aab“, “bab“, “aaab“
a, b
a b
q0 q1 q2
Figure 2: Finite Automaton for Strings Ending with “ab”
4.2 Context-Free Grammar (Type 2)
Grammar:
S → aSb | ϵ It generates strings with equal numbers of a’s and b’s in nested form, like
”aaabbb”.
Derivation for “aaabbb”:
S ⇒ aSb ⇒ aaSbb ⇒ aaaSbbb ⇒ aaabbb
a S b
a S b
a S b
Figure 3: Derivation Tree for the String “aaabbb”
4.3 Context-Sensitive Grammar (Type 1)
Context-sensitive grammars allow production rules where the length of the output is
greater than or equal to the length of the input.
3
KCC Institute of Technology and Management Chomsky Method in TAFL
Example Grammar:
S → aSBC
CB → BC
AB → ab
AC → ac
S → abc
Derivation of the string “aabbcc”:
S ⇒ aSBC ⇒ aaSBCBC ⇒ aaabcBC ⇒ aaabBCc ⇒ aabbcc
S aSBC aaSBCBC aaabcBC aaabBCc aabbcc
Figure 4: Step-by-Step Derivation of the String “aabbcc” Using a Context-Sensitive
Grammar
This grammar generates the language L = {an bn cn | n ≥ 1}, which cannot be gener-
ated by a context-free grammar.
4.4 Unrestricted Grammar (Type 0)
Rules:
S → aSb | SS | ϵ These rules are very flexible and allow complex derivations.
5 Pushdown Automaton (PDA) Example
Language: L = {ab | n ≥ 0}
a, Z → AZa, A → AAb, A → ϵ
b, A → ϵ
ϵ, Z → Z
q0 q1 q2
Figure 5: PDA for Language an bn
6 Chomsky Normal Form (CNF)
A CFG is in CNF if every rule is either:
• A → BC(twonon − terminals)A → a(asingleterminal)
Example:
• S → AX, X → SB | B, A → a, B → b
4
KCC Institute of Technology and Management Chomsky Method in TAFL
7 Applications
• Compilers: Used for syntax and structure analysis
• Natural Language Processing: Parsing and grammar checking
• AI: Learning rules for language understanding
• Programming Languages: Design and error checking
8 Conclusion
The Chomsky hierarchy gives a clear structure to understand different types of formal
grammars. These ideas are the foundation of many tools in computing such as compilers,
interpreters, and parsers.
References
• Hopcroft, J. E., Motwani, R., & Ullman, J. D. (2006). Introduction to Automata
Theory, Languages, and Computation.
• Chomsky, N. (1956). Three models for the description of language. IRE Transac-
tions on Information Theory.
• Sipser, M. (2012). Introduction to the Theory of Computation.