A Stack corrupted exception is raised when there are still items left on the stack after the expression is evaluated.
Possible causes might be a PostfixMathCommand which is not taking the right number of items off the stack.
There can be a problem with the curNumberOfParameters field. A PostFixMathCommand's run() method must make sure to take the curNumberOfParameters off the stack, and push exactly one item back on.
This should only impact on functions which don't implement any of the other function interfaces like BinaryFunction as these don't use the stack.
I would need a bit more information to help debug further. Ideally, the full expression which is causing problems, or possibly the name of all the functions and operators called.
Hope that helps
Richard