Construction of Canonical LR parse table
. Construct C={I0 , . , I n } the sets of LR(1) items.
. If [A
α .a ß , b] is in I i and goto(Ii , a)=Ij
then action[i,a]=shift j
. If [A
α ., a] is in Ii
then action[i,a] reduce A
α
. If [S '
S., $] is in Ii
then action[i,$] = accept
. If goto(I i , A) = Ij then goto[i,A] = j for all non
We are representing shift j as sj and reduction by rule number j as rj. Note that entries corresponding to [state, terminal] are related to action table and [state, non-terminal] related to goto table. We have [1,$] as accept because [S ´
S., $] ε I 1 .