- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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 → ∧)!
To Continue Learning Please Login
Login with Google