I was just looking for references on parser core implementation, and I happened to find this repo. I thought it worth pointing out that this implementation has n squared complexity (on the number of tokens) where it should be linear. This is the result of using shift and unshift to manipulate the tokens array instead of push and pop. Shift is, of course, an O(n) operation on an array as every existing value must move to a new index.
I was just looking for references on parser core implementation, and I happened to find this repo. I thought it worth pointing out that this implementation has n squared complexity (on the number of tokens) where it should be linear. This is the result of using shift and unshift to manipulate the tokens array instead of push and pop. Shift is, of course, an O(n) operation on an array as every existing value must move to a new index.