HOME

TheInfoList



OR:

The Chomsky hierarchy in the fields of
formal language theory In logic, mathematics, computer science, and linguistics, a formal language is a set of string (computer science), strings whose symbols are taken from a set called "#Definition, alphabet". The alphabet of a formal language consists of symbol ...
,
computer science Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, and
linguistics Linguistics is the scientific study of language. The areas of linguistic analysis are syntax (rules governing the structure of sentences), semantics (meaning), Morphology (linguistics), morphology (structure of words), phonetics (speech sounds ...
, is a
containment hierarchy A hierarchy (from Greek: , from , 'president of sacred rites') is an arrangement of items (objects, names, values, categories, etc.) that are represented as being "above", "below", or "at the same level as" one another. Hierarchy is an importan ...
of classes of
formal grammar A formal grammar is a set of Terminal and nonterminal symbols, symbols and the Production (computer science), production rules for rewriting some of them into every possible string of a formal language over an Alphabet (formal languages), alphabe ...
s. A formal grammar describes how to form strings from a formal language's
alphabet An alphabet is a standard set of letter (alphabet), letters written to represent particular sounds in a spoken language. Specifically, letters largely correspond to phonemes as the smallest sound segments that can distinguish one word from a ...
that are valid according to the language's syntax. The linguist
Noam Chomsky Avram Noam Chomsky (born December 7, 1928) is an American professor and public intellectual known for his work in linguistics, political activism, and social criticism. Sometimes called "the father of modern linguistics", Chomsky is also a ...
theorized that four different classes of formal grammars existed that could generate increasingly complex languages. Each class can also completely generate the language of all inferior classes (set inclusive).


History

The general idea of a hierarchy of grammars was first described by Noam Chomsky in "Three models for the description of language" during the formalization of
transformational-generative grammar In linguistics, transformational grammar (TG) or transformational-generative grammar (TGG) was the earliest model of grammar proposed within the research tradition of generative grammar. Like current generative theories, it treated grammar as a sys ...
(TGG).
Marcel-Paul Schützenberger Marcel-Paul "Marco" Schützenberger (24 October 1920 – 29 July 1996) was a French mathematician and Doctor of Medicine. He worked in the fields of formal language, combinatorics, and information theory.Herbert Wilf, Dominique Foata, ''et al.'', ...
also played a role in the development of the theory of
formal language In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet". The alphabet of a formal language consists of symbols that concatenate into strings (also c ...
s; the paper "The algebraic theory of context free languages" describes the modern hierarchy, including context-free grammars. Independently, alongside linguists, mathematicians were developing models of computation (via
automata An automaton (; : automata or automatons) is a relatively self-operating machine, or control mechanism designed to automatically follow a sequence of operations, or respond to predetermined instructions. Some automata, such as bellstrikers i ...
). Parsing a sentence in a language is similar to computation, and the grammars described by Chomsky proved to both resemble and be equivalent in computational power to various machine models.


The hierarchy

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. The classes are defined by the constraints on the productions rules. Note that the set of grammars corresponding to
recursive language In mathematics, logic and computer science, a recursive (or ''decidable'') language is a recursive subset of the Kleene closure of an alphabet. Equivalently, a formal language is recursive if there exists a Turing machine that decides the forma ...
s is not a member of this hierarchy; these would be properly between Type-0 and Type-1. Every regular language is context-free, every context-free language is context-sensitive, 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 that are not context-sensitive, context-sensitive languages that are not context-free and context-free languages that are not regular.


Regular (Type-3) grammars

Type-3 grammars generate the
regular language In theoretical computer science and formal language theory, a regular language (also called a rational language) is a formal language that can be defined by a regular expression, in the strict sense in theoretical computer science (as opposed to ...
s. 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 by a single nonterminal, in which case the grammar is ''right regular''. Alternatively, all the rules can have their right-hand sides consist of a single terminal, possibly ''preceded'' by a single nonterminal (''left regular''). These generate the same languages. However, if left-regular rules and right-regular rules are combined, the language need no longer be regular. The rule S \rightarrow \varepsilon is also allowed here if S 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 A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
. Additionally, this family of formal languages can be obtained by
regular expression A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
s. Regular languages are commonly used to define search patterns and the lexical structure of programming languages. For example, the regular language L = \ is generated by the Type-3 grammar G = (\, \, P, S) with the productions P being the following. : :


Context-free (Type-2) grammars

Type-2 grammars generate the
context-free language In formal language theory, a context-free language (CFL), also called a Chomsky type-2 language, is a language generated by a context-free grammar (CFG). Context-free languages have many applications in programming languages, in particular, mos ...
s. These are defined by rules of the form A \rightarrow \alpha with A being a nonterminal and \alpha being a string of terminals and/or nonterminals. These languages are exactly all languages that can be recognized by a non-deterministic
pushdown automaton In the theory of computation, a branch of theoretical computer science, a pushdown automaton (PDA) is a type of automaton that employs a stack. Pushdown automata are used in theories about what can be computed by machines. They are more capab ...
. Context-free languages—or rather its subset of deterministic context-free languages—are the theoretical basis for the phrase structure of most
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s, though their syntax also includes context-sensitive name resolution due to declarations and scope. Often a subset of grammars is used to make parsing easier, such as by an
LL parser In computer science, an LL parser (left-to-right, leftmost derivation) is a top-down parser for a restricted context-free language. It parses the input from Left to right, performing Leftmost derivation of the sentence. An LL parser is called a ...
. For example, the context-free language L = \ is generated by the Type-2 grammar G = (\, \, P, S) with the productions P being the following. : : The language is context-free but not regular (by the
pumping lemma for regular languages In the theory of formal languages, the pumping lemma for regular languages is a Lemma (mathematics), lemma that describes an essential property of all regular languages. Informally, it says that all sufficiently long string (computer science), st ...
).


Context-sensitive (Type-1) grammars

Type-1 grammars generate
context-sensitive language In formal language theory, a context-sensitive language is a language that can be defined by a context-sensitive grammar (and equivalently by a noncontracting grammar). Context-sensitive is known as type-1 in the Chomsky hierarchy of formal langu ...
s. These grammars have rules of the form \alpha A\beta \rightarrow \alpha\gamma\beta with A a nonterminal and \alpha, \beta and \gamma strings of terminals and/or nonterminals. The strings \alpha and \beta may be empty, but \gamma must be nonempty. The rule S \rightarrow \epsilon is allowed if S 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 In computer science, a linear bounded automaton (plural linear bounded automata, abbreviated LBA) is a restricted form of Turing machine. Operation A linear bounded automaton is a Turing machine that satisfies the following three conditions: * ...
(a nondeterministic Turing machine whose tape is bounded by a constant times the length of the input.) For example, the context-sensitive language L = \ is generated by the Type-1 grammar G = (\, \, P, S) with the productions P being the following. : : : : : : : : : : The language is context-sensitive but not context-free (by the
pumping lemma for context-free languages In computer science, in particular in formal language theory, the pumping lemma for context-free languages, also known as the Bar-Hillel lemma, is a lemma that gives a property shared by all context-free languages and generalizes the pumping le ...
). A proof that this grammar generates L = \ is sketched in the article on Context-sensitive grammars.


Recursively enumerable (Type-0) grammars

Type-0 grammars include all formal grammars. There are no constraints on the productions rules. They generate exactly all languages that can be recognized by a
Turing machine A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer algori ...
, thus any language that is possible to be generated can be generated by a Type-0 grammar. These languages are also known as the ''recursively enumerable'' or ''Turing-recognizable'' languages. Note that this is different from the
recursive language In mathematics, logic and computer science, a recursive (or ''decidable'') language is a recursive subset of the Kleene closure of an alphabet. Equivalently, a formal language is recursive if there exists a Turing machine that decides the forma ...
s, which can be ''decided'' by an always-halting Turing machine.


See also

* Chomsky normal form


Citations


References

* * * {{Authority control 1956 in computing Formal languages Generative linguistics Hierarchy, Chomsky