ISRO Scientist/Engineer CSE 2020Compiler Design › Parsing
ISRO Scientist/Engineer CSE 2020 PYQ: Given the grammar $s \rightarrow T ^{\ast} S\ \mid T$ $T \rightarrow U+T\ \mid U$ $U \rightarrow a \mid b$…
Given the grammar
- $s \rightarrow T ^{\ast} S\ \mid T$
- $T \rightarrow U+T\ \mid U$
- $U \rightarrow a \mid b$
Which of the following statements is wrong?
- AGrammar is not ambiguous
- BPriority of $+$ over $^{\ast}$ is ensured
- CRight to left evaluation of $^{\ast}$ and $+$ happens
- DNone of theseCorrect answer
Answer
(D) None of these
Approach
The question asks which statement is WRONG. Analyze each claim about the grammar: ambiguity, operator precedence, and associativity. The grammar is unambiguous, gives + higher precedence than *, and makes both operators right-associative (right-to-left evaluation). Thus all three statements are true, so the wrong statement is 'None of these'.
Reviewed by ISRO IQ Editorial Team.