GATE | GATE-CS-2005 | Question 59
Consider the grammar
E → E + n | E × n | n
For a sentence n + n × n, the handles in the right-sentential form of the reduction are
(A) n, E + n and E + n × n
(B) n, E + n and E + E × n
(C) n, n + n and n + n × n
(D) n, E + n and E × n
Answer: (D)
Explanation:
E → E * n {Applying E → E * n } → E + n * n {Applying E → E + n } → n + n * n {Applying E → n }
Hence, the handles in right sentential form is n, E + n and E × n.
Please Login to comment...