Next: ref-syn-ops-bop, Previous: ref-syn-ops-ops, Up: ref-syn-ops [Contents][Index]

Note carefully the following syntax restrictions, which serve to remove potential ambiguities associated with prefix operators.

- The arguments of a compound term written in
standard syntax must be expressions of precedence
*less than*1000. Thus it is necessary to write the expression`P:-Q`

in parenthesesassert((P:-Q))

because the precedence of the infix operator ‘

`:-`’, and hence of the expression`P:-Q`

, is 1200. Enclosing the expression in parentheses reduces its precedence to 0. - Similarly, the elements of a list written in
standard syntax must be expressions of precedence
*less than*1000. Thus it is necessary to write the expression`P->Q`

in parentheses[(P->Q)]

because the precedence of the infix operator ‘

`->`’, and hence of the expression`P->Q`

, is 1050. Enclosing the expression in parentheses reduces its precedence to 0. - In a term written in standard syntax, the principal functor and
its following ‘
`(`’ must*not*be separated by any intervening spaces, newlines, or other characters. Thuspoint (X,Y,Z)

is invalid syntax.

- If the argument of a prefix operator starts with a ‘
`(`’, then this ‘`(`’ must be separated from the operator by at least one space or other whitespace character. Thus:-(p;q),r.

(where ‘

`:-`’ is the prefix operator) is invalid syntax. The system would try to interpret it as the structure:, / \ :- r | ; / \ p q

That is, it would take ‘

`:-`’ to be a functor of arity 1. However, since the arguments of a functor are required to be expressions of precedence less than 1000, this interpretation would fail as soon as the ‘`;`’ (precedence 1100) were encountered.In contrast, the term:

:- (p;q),r.

is valid syntax and represents the following structure:

:- | , / \ ; r / \ p q

Send feedback on this subject.