code: function binaryExpression(first, ops, rest) {
    if (associativity[ops[0]] === 'L') {
      const applyLeft = (x, y) => new BinaryExpression(x, ops.shift(), y);
      return [first].concat(rest).reduce(applyLeft);
    } else {
      const applyRight = (x, y) => new BinaryExpression(y, ops.pop(), x);
      return [first].concat(rest).reduceRight(applyRight);
    }
  }
docs: We know that all lists will have ops at the same precedence levels.