4 ms·
I don't think that code reproduces the behavior of the original when the functions shift(tok) and reduce(tok) might return different values for successive calls
by Adlai 17y ago
I don't think that code reproduces the behavior of the original when the functions shift(tok) and reduce(tok) might return different values for successive calls. However, I don't know much about parsers and it could be that in the context of a parser, shift and reduce are proper functions in this sense.
- bullseye 17y agoNo, you are right. In an effort to keep it O(n), I introduced a potential bug. Abecedarius's solution is more correct.