LR(1) Item DFA - Computing Lookaheads
问题 I have trouble understanding how to compute the lookaheads for the LR(1)-items. Lets say that I have this grammar: S -> AB A -> aAb | a B -> d A LR(1)-item is an LR(0) item with a lookahead. So we will get the following LR(0)-item for state 0: S -> .AB , {lookahead} A -> .aAb, {lookahead} A -> .a, {lookahead} State: 1 A -> a.Ab, {lookahead} A -> a. ,{lookahead} A -> .aAb ,{lookahead} A ->.a ,{lookahead} Can somebody explain how to compute the lookaheads ? What is the general approach ? Thank