1,190 views
0 votes
0 votes

Give an Example of production rules for Context sensitive grammar?

I could find only this example from Wikipedia...
Can you share any ther simple example?

1.         S     →     a B C
2.   S a S B C
3. C B C Z
4. C Z W Z
5. W Z W C
6. W C B C
7. a B a b
8. b B b b  
9. b C b c
10. c C c c

1 Answer

0 votes
0 votes

Just note that the Context Sensitive Grammar is represented as:

α -----> β , |α| ≤ |β| and α, β ϵ (V+T)+  (where, V : Non-terminal and T : Terminal)

That is (V+T)------> (V+T)  (where LHS is subset of RHS,   LHS ≤ RHS ) also add the production S -----> λ (as CSG cannot generate λ)

So any productions folllowing the above format is a CSG.

Related questions

0 votes
0 votes
0 answers
1
2 votes
2 votes
0 answers
2
Meenakshi Sharma asked Oct 10, 2018
541 views
can someone explain diff between REC , Rec enumerable and context sensitive language with clear examplelike language is RE but not not REC and REC but not CSL
0 votes
0 votes
0 answers
3
nany256 asked Jul 11, 2018
171 views
What is the context sensitive grammar for a^n * b^n * c^n * d^n and n >=1a,b,c,d are input symbols and A,B,C,D are vertices.
0 votes
0 votes
1 answer
4
preethi01 asked Jan 29, 2022
1,646 views
Is the following CSG for a^n b^n c^n correct?S->aSbC|abcCb->bCC->cIf not please explain why?