Next: IO, Previous: Introduction, Up: Top [Contents]
Prolog and Mercury have very similar syntax. Although there are a few differences, by and large if the syntax of a program is accepted by a Prolog system, it will be accepted by Mercury. There are however a few extra operators defined by the Mercury term parser (see the “Operators” section of the “Syntax” chapter of the Mercury Language Reference Manual).
In addition, Mercury implements both existential and universal quantification using the syntax
some Vars Goal
and
all Vars Goal
String literals are atomic; they are not abbreviations for lists of character codes.
The constructor for lists in Mercury is ‘[|]/2’, not ‘./2’.
Terms with functor ’{}/N’ are treated slightly differently in Mercury
than in ISO Prolog. ISO Prolog specifies that “{1, 2, 3}” is parsed as
'{}'(','(1, ','(2, 3)))
. In Mercury, it is parsed as
'{}'(1, 2, 3)
.
Mercury does not allow users to define their own operators.