Beginner
Compilers & Programming Language Theory
Q15 / 100
What is a shift-reduce conflict?
Correct! Well done.
Incorrect.
The correct answer is B) An ambiguity in an LR parser where it's unclear whether to shift (read next token) or reduce (apply a production) at a state
B
Correct Answer
An ambiguity in an LR parser where it's unclear whether to shift (read next token) or reduce (apply a production) at a state
Explanation
Shift-reduce conflict: in "if (cond) if (cond) stmt else stmt" — the else might belong to either if (dangling else). Resolved by convention (else matches nearest if) or grammar disambiguation.
Progress
15/100