Multiple choice

Consider the grammar E ® E + n | E x n | n For a sentence n + n x n, the handles in the right-sentential form of the reduction are

  1. n, E + n and E + n x n

  2. n, E + n and E + E x n

  3. n, n + n and n + n x n

  4. n, E + n and E x n

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A handle is a substring that matches the right side of a production rule and whose reduction represents one step along the reverse of a rightmost derivation. For n + n x n, the steps are: n -> F -> T -> E; then E + n -> E + F -> E + T -> E; then E x n -> E x F -> E x T -> E.