Q34: Context free grammar contd.

This question is in continuation of the previous questions 29 and 30

Question #34: If we remove production 4 in the grammar mentioned in 29 , which of the following will be hampered?

A)     Production 4 is used to enforce priority, e.g. in the string 6 + 7 * 8, if we want to perform the addition first, we must use brackets in this way (6 + 7) * 8.

B)      Production 4 is used to enforce priority, e.g. in the string 6 + 7 * 8, if we want to perform the multiplication first, we must use brackets in this way 6 + (7 * 8).

C)      Production 4 is present in above grammar because it makes the strings non-ambiguous, they don’t add any power to the language.

D)     None of the above.

 

Solution:

Multiplication anyways has higher priority than addition operator, brackets are required in cases where we want to reverse the priority. Hence, the correct answer is A