partially completed function to parse binary expressions