7 ms·
This code does not work like the original. Consider the case of a reduce does not shift: gettoken == not END, shift == false, reduce == true, shift == false
by nkurz 17y ago
This code does not work like the original. Consider the case of a reduce does not shift: gettoken == not END, shift == false, reduce == true, shift == false.
In the original code, the next operation is (correctly) another reduce. In your example, you stop reducing too soon and read the next token. Furthermore, I find that the labels in the original make the logic easier to follow.