Given the following expression grammar: 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. - has higher precedence than *
Explanation: F is lower in the parse tree (closer to leaves) for '-' operations than E is for '*'. Thus '-' binds tighter.