Question:medium

A grammar is given:
$E \rightarrow E + T \mid T$
$T \rightarrow T * F \mid F$
$F \rightarrow (E) \mid id$
For the input: $id + id * id$, what is the correct interpretation?

Show Hint

This is a standard "Expression Grammar." To remember precedence, look at the depth: the deeper the operator is in the grammar tree, the higher its priority. Multiplication is "deeper" than addition here.
Updated On: Jul 4, 2026
  • $(id + id) * id$
  • $id + (id * id)$
  • $(id + id * id)$
  • Ambiguous expression
Show Solution

The Correct Option is B

Solution and Explanation

Was this answer helpful?
0