Parentheses matching algorithm, implemented by intMatch() and
stackMatch();