In order to define associativity the way you have, operators have to be parsed n-ary. Currently the only n-ary operators are +
and *
which are usually associative anyway. Unfortunately, even with n-ary parsing, mixing different operators with the same precedence will have the operator’s default associativity.
The reason operator associativity cannot be defined by the programmer in general (except via nary parsing, if applicable) is that the precedence of the operator must be known at parse time, whereas what the operator means is only knowable at runtime in general.