The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+9 votes
1.7k views

Which of the following grammar rules violate the requirements of an operator grammar? P, Q, R are nonterminals, and r, s, t are terminals.

  1. P $\rightarrow$ Q R

  2. P $\rightarrow$ Q s R

  3. P $\rightarrow \: ε$

  4. P $\rightarrow$ Q t R r

  1. (I) only
  2. (I) and (III) only
  3. (II) and (III) only
  4. (III) and (IV) only
asked in Compiler Design by Veteran (59.4k points) | 1.7k views
0
ans-B

2 Answers

+22 votes
Best answer

answer is B .because operator grammer  does not contain  1)  nullable variable  2) 2 adjacent non-terminal on rhs of production

answered by (233 points)
edited by
+8 votes
(I) P --> QR is not possible since two Non Terminal  should include one operator as Terminal.
(II) Correct
(III)  incorrect.
(IV) Correct.

so I and III violate the requirements of an operator grammar.

Hence (B) is correct option
answered by Veteran (66.7k points)
0
is PQ-->RsT is operator grammar or not?
+7

no, PQ-->RsT will also not be in operator grammer, because

PQ is present in LHS means it has also been generated by some production like V ---> αPQβ which is also in grammer and voilating operator precedence condition..

0
No, PQ-> RsT is not context free, so it cant be operator grammar.
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

35,506 questions
42,827 answers
121,678 comments
42,181 users