recategorized by
2,976 views
0 votes
0 votes
Which of the following statements is correct about context sensitive grammar?
I) In a context sensitive grammar, ε can’t be the right hand side of any production

II) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of grammar symbols on the right hand side

III) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of terminals on the right hand side

IV) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of non-terminals on the right hand side

Isn't (II) (non contracting grammar is also CSL) and (IV) both are correct
recategorized by

1 Answer

0 votes
0 votes

For a grammar to be CSG, the length of the LHS should be less than the length of RHS. And LHS and RHS could be any combination of variables and terminals.

I) In a context sensitive grammar, ε can’t be the right hand side of any production

The production S → e is also allowed if S is the start symbol and it does not appear on the right side of any production.
So, Option A eliminated.

Source: https://www.csa.iisc.ac.in/~deepakd/atc-2016/Seminar-CSG.pdf (Page 5)

 

II) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of grammar symbols on the right hand side

Completely true! Option B is the answer

 

III) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of terminals on the right hand side

$AB -> 2CDE$ is valid. So, Option C is incorrect.

 

IV) In a context sensitive grammar, number of grammar symbols on the left hand side of a production can’t be greater than the number of non-terminals on the right hand side

$S -> 123$ is valid. So, Option D is also incorrect.

Source: https://www.csa.iisc.ac.in/~deepakd/atc-2016/Seminar-CSG.pdf (Page 8)

Related questions

0 votes
0 votes
1 answer
3
rsansiya111 asked Dec 18, 2021
392 views
0 votes
0 votes
1 answer
4
Sumit Singh Chauhan asked Aug 18, 2018
3,453 views
What is time complexity of fun()?int fun(int n){ int count = 0; for (int i = n; i 0; i /= 2) for (int j = 0; j < i; j++) count += 1; return count;}(A) O(n^...