edited by
11,030 views
21 votes
21 votes

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 \: \varepsilon$

  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
edited by

2 Answers

Best answer
41 votes
41 votes

answer is B.

Operator grammar  cannot contain  

  1. Nullable variable  
  2. Two adjacent non-terminal on $\text{RHS}$ of production
edited by
10 votes
10 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
Answer:

Related questions

31 votes
31 votes
2 answers
2
Kathleen asked Sep 18, 2014
10,912 views
Consider the grammar with the following translation rules and $E$ as the start symbol$$\begin{array}{lll}E \rightarrow E_ 1\# \: T & \qquad\left\{E.value = E_1.value * ...
29 votes
29 votes
2 answers
4
Kathleen asked Sep 18, 2014
6,360 views
Consider a program $P$ that consists of two source modules $M_1$ and $M_2$ contained in two different files. If $M_1$ contains a reference to a function defined in $M_2$ ...