TOC_pdf
TOC_pdf
OF GRAMMAR
Content:
In 1956, Noam Chomsky introduced a hierarchy of grammars that classifies languages
based on their generative power.
This hierarchy is crucial for understanding formal language theory, automata, and
computational linguistics.
Each grammar type corresponds to a computational model, ranging from simple finite
automata to powerful Turing machines.
Overview of the Four Types of Grammars
Type 0 – Recursively Enumerable Grammars
Definition:
Type 0 grammars are also known as phrase structure
grammars or semi-Thue grammars.
They can generate any language that can be recognized
by a Turing machine.
Characteristics:
No restrictions on production rules.
Requires a Turing Machine to recognize languages.
Some languages generated by this grammar are not
decidable (e.g., Halting Problem).
Type 1 – Context-Sensitive Grammars (CSG)
Definition:
Every production rule follows the form:
α → β, where |α| ≤ |β|
Recognized by Linear Bounded Automaton (LBA).
More restrictive than Type 0, but still powerful enough for
natural language processing.
Example:
Applications:
Used in compilers, programming languages, and NLP.
Type 2 – Context-Free Grammars (CFG)
Definition:
A grammar where the left-hand side of every
production contains a single non-terminal.
Recognized by a Pushdown Automaton (PDA).
Used extensively in compilers and programming
languages.
|α| =1 There is no restriction on β.The production rules
are in the form of −
A->α, Where, A is any single non-
terminal and is any combination of terminals
and nonterminals.
Example: S --> AB
A --> a
B --> b
Applications: Syntax analysis in programming languages
HTML/XML parsing, Arithmetic expressions, AI grammar .
Type 3 – Regular Grammars (RG)
Definition:
Most restricted grammar, where rules follow:
A → aB (Right Linear) or A → a (Left Linear).
Recognized by a Finite Automaton (DFA/NFA).
Used in lexical analysis, regex, and pattern matching.
Example:
L = { a⁺ }
A language containing one or more occurrences of ‘a’.
Applications:
Text searching, lexical analysis
in compilers, and pattern
matching algorithms.
References
References
GeeksForGeeks.com
Theory of Computation-KLP Mishra
ChatGPT
THANK YOU!!!