All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · December 2023

Consider the grammar E → E + n | E × n | n. For the sentence n + n × n, the handles in the right-sentential forms of the reduction are:

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. n, E + n and E × n

Explanation

Bottom-up: n + n × n ⇒ reduce the first n (handle n) → E + n × n ⇒ reduce E + n → E × n ⇒ reduce E × n → E. Handles: n, E + n, E × n.

More Theory of Computation and Compilers questions