- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a context sensitive language in TOC?
A context-sensitive grammar whose productions are of the form
αAβ → αγβ
Where α, β ∈ (N ∪ T)*, A ∈ N; γ ∈ (N ∪ T)+ and a rule of the form S → λ is allowed if the start symbol S do not appear on the right hand side of any rule.
The language generated by such a grammar is called a context-sensitive language.
Every context-free grammar is also context-sensitive =⇒ the context-free languages are a subset of the context-sensitive languages (see Chomsky Normal Form).
But, not every context-sensitive language is context-free.
Example
The language {anbncn, n > 1} is context-sensitive but not context free.
A grammar for this language is given by: S → aSBC | aBC, CB → HB, HB → HC, HC → BC, aB → ab, bB → bb, bC → bc, cC → cc A derivation e.g. aabbcc, using this grammar is: S ⇒ aSBC ⇒ aaBCBC (using S → aBC) ⇒ aabCBC (using aB → ab) ⇒ aabHBC (using CB → HB) ⇒ aabHCC (using HB → HC) ⇒ aabBCC (using HC → BC) ⇒ aabbCC (using bB → bb) ⇒ aabbcC (using bC → bc) ⇒ aabbcc (using cC → cc)
The context-sensitive languages can also be generated by a monotonic grammar, any production is allowed, as long as there are no rules for making strings shorter (except one S → ∧)!
- Related Articles
- What is Context-sensitive Grammar?
- Is JavaScript a case sensitive language?
- Explain the simplification of context free grammar in TOC
- What are the closure properties for context free language?
- How to identify if a language is regular or not in TOC?
- Explain Pumping lemma for context free language
- What is a Derivation tree in TOC?
- What is a mealy machine in TOC?
- What is a Moore Machine in TOC?
- Explain the different operations on Regular language in TOC.
- Explain the relationship between grammar and language in TOC
- Explain formal definition of language with examples in TOC?
- What is Decidability in TOC?
- Explain the context free language closure under concatenation?
- Explain about pumping lemma for context free language?
