Definition
Chomsky Hierarchy
The Chomsky hierarchy classifies formal languages by increasing expressive power. Its levels are regular languages (
, context-free languages ( , context-sensitive languages ( ), recursive language ( ), and recursively enumerable languages ( ). Each class properly contains the one below it. Formally:
Closure
| Operation | ||||
|---|---|---|---|---|
| Union | yes | yes | yes | yes |
| Concatenation | yes | yes | yes | yes |
| Kleene Star | yes | yes | yes | yes |
| Complement | yes | no | yes | no |
| Intersection | yes | no | yes | yes |
| Intersection with Regular Languages | yes | yes | yes | yes |
| Homomorphisms | yes | yes | no | yes |
| yes | yes | yes | yes | |
| gsm-mappings | yes | yes | no | yes |
| yes | yes | yes | yes |
Sub-languages
Being a subset does not determine the Chomsky type.
If
Subset can have higher type
The regular language
contains the context-sensitive language . So a subset of a regular language can have higher Chomsky type than the language itself.
Subset can have lower type
The context-sensitive language
contains the context-free language . So a subset of a context-sensitive language can have lower Chomsky type than the language itself.
Subset can be arbitrary
The language
is regular, but it contains every language over , including languages that are not even recursively enumerable. So a subset of a regular language can be arbitrarily complex.
Types
Type 0 - Unconstrained
Definition
Link to originalGrammar
A grammar is defined as 4-tuple
, where
is the finite set of non-terminal symbols, is the finite set of terminal symbols, is the finite set of production rules (relation), and is the start symbol. Without further constraints,
is called unconstrained grammar or type-0 grammar and is the most general form of a grammar in the Chomsky hierarchy.
Type 1 - Context-Sensitive
Definition
Link to originalContext-Sensitive Grammar (Type-1)
A grammar
is called context-sensitive (Type-1) if every production rule in is context-sensitive. In words: a single non-terminal symbol may be replaced by a nonempty string, but only in its surrounding context.
Type 2 - Context-Free
Definition
Link to originalContext-Free Grammar
A grammar
is called context-free if every production rule in is context-free. Equivalently: A language is called context-free there exists a pushdown automaton that accepts it.
Type 3 - Regular
Definition
Link to originalRegular Grammar
A grammar
is called regular if every production rule is regular.