Chomsky Hierarchy - The Hierarchy

The Hierarchy

The Chomsky hierarchy consists of the following levels:

  • Type-0 grammars (unrestricted grammars) include all formal grammars. They generate exactly all languages that can be recognized by a Turing machine. These languages are also known as the recursively enumerable languages. Note that this is different from the recursive languages which can be decided by an always-halting Turing machine.
  • Type-1 grammars (context-sensitive grammars) generate the context-sensitive languages. These grammars have rules of the form with a nonterminal and, and strings of terminals and nonterminals. The strings and may be empty, but must be nonempty. The rule is allowed if does not appear on the right side of any rule. The languages described by these grammars are exactly all languages that can be recognized by a linear bounded automaton (a nondeterministic Turing machine whose tape is bounded by a constant times the length of the input.)
  • Type-2 grammars (context-free grammars) generate the context-free languages. These are defined by rules of the form with a nonterminal and a string of terminals and nonterminals. These languages are exactly all languages that can be recognized by a non-deterministic pushdown automaton. Context-free languages are the theoretical basis for the syntax of most programming languages.
  • Type-3 grammars (regular grammars) generate the regular languages. Such a grammar restricts its rules to a single nonterminal on the left-hand side and a right-hand side consisting of a single terminal, possibly followed (or preceded, but not both in the same grammar) by a single nonterminal. The rule is also allowed here if does not appear on the right side of any rule. These languages are exactly all languages that can be decided by a finite state automaton. Additionally, this family of formal languages can be obtained by regular expressions. Regular languages are commonly used to define search patterns and the lexical structure of programming languages.

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.

Grammar Languages Automaton Production rules (constraints)
Type-0 Recursively enumerable Turing machine (no restrictions)
Type-1 Context-sensitive Linear-bounded non-deterministic Turing machine
Type-2 Context-free Non-deterministic pushdown automaton
Type-3 Regular Finite state automaton
and

However, there are further categories of formal languages, some of which are given in the following table:

Automata theory: formal languages and formal grammars
Chomsky hierarchy Grammars Languages Minimal automaton
Type-0 Unrestricted Recursively enumerable Turing machine
(no common name) Recursive Decider
Type-1 Context-sensitive Context-sensitive Linear-bounded
Indexed Indexed Nested stack
Linear context-free rewriting systems etc. Mildly context-sensitive Thread automata
Tree-adjoining etc. Tree-adjoining Embedded pushdown
Type-2 Context-free Context-free Nondeterministic pushdown
Deterministic context-free Deterministic context-free Deterministic pushdown
Visibly pushdown Visibly pushdown Visibly pushdown
Type-3 Regular Regular Finite
Star-free Counter-free (with aperiodic finite monoid)

Read more about this topic:  Chomsky Hierarchy

Famous quotes containing the word hierarchy:

    In a hierarchy every employee tends to rise to his level of incompetence.
    Laurence J. Peter (1919–1990)

    In the world of the celebrity, the hierarchy of publicity has replaced the hierarchy of descent and even of great wealth.
    C. Wright Mills (1916–1962)