Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


No, you are right. In an effort to keep it O(n), I introduced a potential bug. Abecedarius's solution is more correct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: