Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Given the following expression grammar
    E → E * F | F + E | F
    E → F – | id
    Which of the following is true?
    1. * has higher precedence than +
    2. – has higher precedence than *
    3. + and – have same precedence
    4. + has higher precedence than *
Correct Option: B

‘–’ has higher precedence than ‘*’ as ‘–’ is a leaf node in the tree formed using this whereas ‘*’ is not.



Your comments will be displayed only after manual approval.