Which of the following grammar rules violate the requirements of an operator…
2004
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 → Q R
2. P → Q s R
3. P → ε
4. P → Q t R r - A.
1 only
- B.
1 and 3 only
- C.
2 and 3 only
- D.
3 and 4 only
Attempted by 74 students.
Show answer & explanation
Correct answer: B
Operator grammar constraints: an operator grammar does not allow empty (ε) productions and does not allow two adjacent nonterminals on the right-hand side of any production.
P → Q R : Has two adjacent nonterminals (Q and R) — this violates the 'no adjacent nonterminals' rule.
P → Q s R : Nonterminals are separated by the terminal s, so there are no adjacent nonterminals — this production is allowed.
P → ε : This is an empty production (ε) — operator grammars forbid ε-productions, so this violates the rules.
P → Q t R r : Nonterminals Q and R are separated by the terminal t (and followed by terminal r), so no adjacent nonterminals — this production is allowed.
Conclusion: the productions that violate operator-grammar requirements are P → Q R and P → ε. Therefore the correct selection is the set containing those two productions.
A video solution is available for this question — log in and enroll to watch it.