Chapter 4: Syntax Analysis

Shift reduce conflict

Consider the grammar E E+E | E*E | id and

input id+id*id

stack
input action stack input action
E+E
*id reduce by E E+E E+E *id shift
E
*id shift E+E* id shift
E*
id shift E+E*id   reduce by E id
E*id
  reduce by E id E+E*E   reduce by E E*E
E*E
  reduce byE E*E E+E   reduce by E E+E
E
    E