In case (1), A is replaced by ß By , and then the rightmost non-terminal B in that right side is replaced by γ . In case (2), A is again replaced first, but this time the right side is a string y of terminals only. The next rightmost non-terminal B will be somewhere to the left of y .
In both cases, after making a reduction the parser had to shift zero or more symbols to get the next handle onto the stack. It never had to go into the stack to find the handle. It is this aspect of handle pruning that makes a stack a particularly convenient data structure for implementing a shift-reduce parser.