Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Chomsky hierarchy
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Context-sensitive (Type-1) grammars=== {{main|Context-sensitive grammar}} Type-1 grammars generate [[context-sensitive language]]s. These grammars have rules of the form <math>\alpha A\beta \rightarrow \alpha\gamma\beta</math> with <math>A</math> a nonterminal and <math>\alpha</math>, <math>\beta</math> and <math>\gamma</math> strings of terminals and/or nonterminals. The strings <math>\alpha</math> and <math>\beta</math> may be empty, but <math>\gamma</math> must be nonempty. The rule <math>S \rightarrow \epsilon</math> is allowed if <math>S</math> 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.) For example, the context-sensitive language <math>L = \{a^nb^nc^n \mid n > 0\}</math> is generated by the Type-1 grammar <math>G = (\{S,A,B,C,W,Z\}, \{a, b, c\}, P, S)</math> with the productions <math>P</math> being the following. :{{math|''S'' β ''aBC''}} :{{math|''S'' β ''aSBC''}} :{{math|''CB'' β ''CZ''}} :{{math|''CZ'' β ''WZ''}} :{{math|''WZ'' β ''WC''}} :{{math|''WC'' β ''BC''}} :{{math|''aB'' β ''ab''}} :{{math|''bB'' β ''bb''}} :{{math|''bC'' β ''bc''}} :{{math|''cC'' β ''cc''}} The language is context-sensitive but not context-free (by the [[pumping lemma for context-free languages]]). A proof that this grammar generates <math>L = \{a^nb^nc^n \mid n > 0\}</math> is sketched in the article on [[Context-sensitive grammar#anbncn|Context-sensitive grammars]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)