Rewritten the parsing stack.  It is now much simpler and easy to modify.
Obtaining the stack size takes now constant time.