Which grammar rules violate the requirement of the operator grammar? A, B, C…

2020

Which grammar rules violate the requirement of the operator grammar? A, B, C are variables and a, b, c are terminals.

i. A → BC
ii. A → CcBb
iii. A → BaC
iv. A → ε

  1. A.

    i only

  2. B.

    i and ii

  3. C.

    i and iii

  4. D.

    i and iv

Attempted by 86 students.

Show answer & explanation

Correct answer: D

An Operator Grammar must satisfy two strict conditions:

  1. No production can have an ε (null) on the right-hand side.

  2. No two non-terminals (variables) can appear adjacently on the right-hand side.

  • Rule i (A BC): Violates condition 2 because B and C are adjacent variables.

  • Rule ii (A CcBb): Valid. Variables are separated by terminal c.

  • Rule iii (A BaC): Valid. Variables are separated by terminal a.

  • Rule iv (A ε): Violates condition 1 due to the null production.

Thus, i and iv violate the requirements.

Correct Answer: i and iv (Option D).

Explore the full course: Niacl Ao It Specialist