Consider two binary operators '
' and '
' with the precedence of operator
being lower than that of the
is right associative while operator
is left associative. Which one of the following represents the parse tree for expression (7
2)? (GATE CS 2011)
Let us consider the given expression (
Since the precedence of
is higher, the sub-expression (
) will be evaluated first. In this sub-expression,
would be evaluated first because
is right to left associative. So the expression is evaluated as
. Also, note that among the two
operators, first one is evaluated before the second one because the associativity of
is left to right.