Given the following expression grammar : E → E ⋆ F | F + E | F F→ F - F| id Which of the following is true? 

Given the following expression grammar : E → E ⋆ F | F + E | F F→ F - F| id Which of the following is true?  Correct Answer - has higher precedence than ⋆ 

 The correct answer is "option 2".                   

CONCEPT:

Consider the expession "id-id+id*id" :

[ alt="F1 Raju Madhuri 20.04.2021 D2" src="//storage.googleapis.com/tb-img/production/21/04/F1_Raju_Madhuri_20.04.2021_D2.png" style="width: 157px; height: 200px;">

Option 1: False

'+' has higher precedence than '⋆ ', since '+' will execute before '*'.

Option 3: False

'-' has higher precedence than '+ ', since '-' will execute before '+'.

Option 4: False

'*' & '+' have same precedence.

Hence, the correct answer is "option 2".

Related Questions

Which of the following statements are true and which of them are not true? a. A language without script is dialect. b. A language may have many dialects. c. Some languages do not have grammar. d. Sign language does not have a grammar.