Helper function for binary operation parsing.