Chomsky Hierarchy
Chomsky Hierarchy
Chomsky Hierarchy
Within the field of computer science, specifically in the area of formal languages, the
Chomsky hierarchy (occasionally referred to as Chomsky–Schützenberger hierarchy)
is a containment hierarchy of classes of formal grammars.
This hierarchy of grammars was described by Noam Chomsky in 1956.[1] It is also named
after Marcel-Paul Schützenberger who played a crucial role in the development of the
theory of formal languages.
Formal grammars
A formal grammar of this type consists of:
A formal grammar defines (or generates) a formal language, which is a (usually infinite)
set of finite-length sequences of symbols (i.e. strings) that may be constructed by
applying production rules to another sequence of symbols which initially contains just the
start symbol. A rule may be applied to a sequence of symbols by replacing an occurrence
of the symbols on the left-hand side of the rule with those that appear on the right-hand
side. A sequence of rule applications is called a derivation. Such a grammar defines the
formal language: all words consisting solely of terminal symbols which can be reached
by a derivation from the start symbol.
S ABS
S ε (where ε is the empty string)
BA AB
BS b
Bb bb
Ab ab
Aa aa
and start symbol S, defines the language of all words of the form anbn (i.e. n copies of a
followed by n copies of b). The following is a simpler grammar that defines the same
language: Terminals {a,b}, Nonterminals {S}, Start symbol S, Production rules
S aSb
S ε
The hierarchy
Note that the set of grammars corresponding to recursive languages is not a member of
this hierarchy.
Every regular language is context-free, every context-free language, not containing the
empty string, is context-sensitive and every context-sensitive language is recursive and
every recursive language is recursively enumerable. These are all proper inclusions,
meaning that there exist recursively enumerable languages which are not context-
sensitive, context-sensitive languages which are not context-free and context-free
languages which are not regular.
The following table summarizes each of Chomsky's four types of grammars, the class of
language it generates, the type of automaton that recognizes it, and the form its rules must
have.
Production rules
Grammar Languages Automaton
(constraints)
Recursively
Type-0 Turing machine (no restrictions)
enumerable
Linear-bounded non-
Type-1 Context-sensitive
deterministic Turing machine
Non-deterministic pushdown
Type-2 Context-free
automaton
Site of TQ
http://www.globalguideline.com/interview_questions/Questions.php?
sc=C_puls_plus_Programming&page=2