Advanced Compilers & Programming Language Theory
Q99 / 100

How does an LR parser generator construct its canonical collection of LR(0) item sets, and why does this determine the parser's states?

Correct! Well done.

Incorrect.

The correct answer is D) By repeatedly applying the closure and goto operations starting from the augmented grammar's initial item set, where each resulting item set becomes a distinct parser state encoding exactly how much of which productions has been recognized so far

D

Correct Answer

By repeatedly applying the closure and goto operations starting from the augmented grammar's initial item set, where each resulting item set becomes a distinct parser state encoding exactly how much of which productions has been recognized so far

Explanation

The canonical LR(0) construction starts from the item S' -> .S, applies closure (adding items reachable via epsilon-like derivation) and goto (advancing the dot over a grammar symbol) until no new item sets appear. Each item set becomes a parser state, and transitions between them form the LR automaton that drives shift/reduce decisions.

Progress
99/100