add a simple error detection for mismatched parenthesis