A context-sensitive grammar is a formal grammar G = (N, Σ, P, S) such that all rules in P are of the form
The name context-sensitive is explained by the α and β that form the context of A and determine whether A can be replaced with γ or not. This is different from a context-free grammar where the context of a nonterminal is not taken into consideration. A formal language that can be described by a context-sensitive grammar is called a context-sensitive language.
The concept of context-sensitive grammar was introduced by Noam Chomsky in the 1950s as a way to describe the syntax of natural language where it is indeed often the case that a word may or may not be appropriate in a certain place depending upon the context.
While the noncontracting grammars are different from the context-sensitive ones, the two are almost equivalent in the sense that they define the same class of languages (except that noncontracting grammars cannot generate any language that contains the empty string ε). But if a formal language L can be described by a grammar of the first definition then there is a noncontracting grammar that describes L - {ε}, and vice versa.
It has been shown that nearly all natural languages may in general be characterized by context-sensitive grammars, however the whole class of CSG's seems to be much bigger than natural languages. Worse yet, since the aforementioned decision problem for CSG's is PSPACE-complete, that makes them totally unworkable for practical use, as the general algorithm would take exponential time. Ongoing research on computational linguistics has focused on formulating other classes of languages that are "mildly context-sensitive" whose decision problems are feasible, such as tree-adjoining grammars, coupled context-free languages, and linear context-free rewriting systems. The languages generated by these formalisms properly lie between the context-free and context-sensitive languages.
See also: Chomsky hierarchy
Kontextová gramatika | Kontextsensitive Grammatik | Gramáticas sensibles al contexto | Grammatica sensibile al contesto | 文脈依存文法 | Gramáticas sensíveis ao contexto | Kontextovo citlivá gramatika
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Context-sensitive grammar".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world