Modula-3: Operation syntax

# Operation syntax

The operators that have special syntax are classified and listed in order of decreasing binding power in the following table:

        x.a                   infix dot
        f(x) a[i] T{x}        applicative (, [, {
        p^                    postfix ^
        +  -                  prefix arithmetics
        * / DIV MOD           infix arithmetics
        + - &                 infix arithmetics
        = # < <= >= > IN      infix relations
        NOT                   prefix NOT
        AND                   infix AND
        OR                    infix OR

All infix operators are left associative. Parentheses can be used to override the precedence rules. Here are some examples of expressions together with their fully parenthesized forms:

        M.F(x)           (M.F)(x)           dot before application
        Q(x)^            (Q(x))^            application before ^
        - p^             - (p^)             ^ before prefix -
        - a * b          (- a) * b          prefix - before *
        a * b - c        (a * b) - c        * before infix -
        x IN s - t       x IN (s - t)       infix - before IN
        NOT x IN s       NOT (x IN s)       IN before NOT
        NOT p AND q      (NOT p) AND q      NOT before AND
        A OR B AND C     A OR (B AND C)     AND before OR

Operators without special syntax are procedural. An application of a procedural operator has the form `op(args)`, where `op` is the operation and `args` is the list of argument expressions. For example, `MAX` and `MIN` are procedural operators.

    Last modified on Wed Apr  3 09:39:01 PST 1996 by heydon
         modified on Fri Apr 15 15:29:56 PDT 1994 by kalsow