7.22 Declaring New Infix Operators

Users can add new infix operators by using the declarations INFIX and PRECEDENCE. For example,

        infix mm;  
        precedence mm,-;

The declaration infix mm; would allow one to use the symbol MM as an infix operator:

  a mm b  instead of   mm(a,b).

The declaration precedence mm,-; says that MM should be inserted into the infix operator precedence list just after the - operator. This gives it higher precedence than - and lower precedence than * . Thus

  a - b mm c - d  means   a - (b mm c) - d,


  a * b mm c * d  means   (a * b) mm (c * d).

Both infix and prefix operators have no transformation properties unless LET statements or procedure declarations are used to assign a meaning.

We should note here that infix operators so defined are always binary:

  a mm b mm c  means   (a mm b) mm c.