E -> E * F / F + E / F
F -> F
– F / id
Which of the following is true ?
(A) *has higher precedence than +
(B) – has higher precedence than *
(C) + and – have same precedence
(D) + has higher precedence than *
Answer(B).
Lowest precedence operators are
last, at the top of tree.
Make the derivation tree and check
that * is always on the top. That is why – has higher precedence than *.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.