← ⬆️ Bottom-up Parsing (LR family)
Subtopic 2 of 6

5.2LR(0) items, closure and goto

An item is a production with a dot (A → α • β). closure(I) adds B → • γ for each B right after a dot. goto(I, X) moves the dot over X. The states of the DFA are the canonical collection.

States7
Conflicts0
I0
S' → • S
S → • C C
C → • c C
C → • d
S→I1 C→I2 c→I3 d→I4
I1
S' → S •
no transitions
I2
S → C • C
C → • c C
C → • d
C→I5 c→I3 d→I4
I3
C → • c C
C → c • C
C → • d
c→I3 C→I6 d→I4
I4
C → d •
no transitions
I5
S → C C •
no transitions
I6
C → c C •
no transitions

Closure adds items for every non-terminal right after the dot; goto(I, X) moves the dot over X.

Previous year questions: Bottom-up Parsing (LR family) (12)

PYQs are grouped by topic, so this is the full set for Bottom-up Parsing (LR family); try the ones that match this subtopic. Open all 12 on the topic page.