Given the grammar: s → T * S⏐T T → U + T⏐U U → a⏐b Which of the following…
2020
Given the grammar:
s → T * S⏐T
T → U + T⏐U
U → a⏐b Which of the following statement is wrong ? , ISRO 2020
- A.
Grammar is not ambiguous
- B.
Priority of + over * is ensured
- C.
Right to left evaluation of * and + happens
- D.
None of these
Attempted by 69 students.
Show answer & explanation
Correct answer: D
Analyze the grammar hierarchy to determine operator precedence.
The start symbol S defines multiplication (S → T * S | T).
The non-terminal T defines addition (T → U + T | U).
Since T is a sub-component of S, addition operations are evaluated before multiplication.
Therefore, '+' has higher precedence than '*'. Any statement claiming this is correct.
Since the question asks for the wrong statement and the grammar behavior is accurately described in other options, 'None of these' is the correct choice.
A video solution is available for this question — log in and enroll to watch it.