A.4 Syntax Differences between ECLiPSe and other Prologs
ECLiPSe supports the following extensions of Prolog syntax:
-
Attributed variables: X{Attr}.
- Rational numbers: 3_4.
- Bounded real numbers: 1.99__2.01.
- Array subscripts: Matrix[3,4].
- Structures with named fields: emp{age:33,salary:33000}.
- Binary prefix operators: some X p(X).
Some of these extensions can be disabled via syntax option settings
(this is done for example by the compatibility packages).
In addition to the above extensions, the following minor differences
exist between default ECLiPSe syntax and most Prolog systems:
-
In ECLiPSe, end of file is accepted as fullstop.
- By default, an unquoted vertical bar can be used as an atom or
functor (controlled by the syntax option bar_is_no_atom).
- By default, operators with precedence higher than 1000 are allowed
in a comma-separated list of terms, i.e., structure arguments
and lists. The ambiguity is resolved by considering commas
as argument separators rather than operators inside the term.
Thus, for example,
p(a :- b, c)
is accepted and parsed as p/2. This behaviour can be disabled
(and turned into a syntax error) by setting the syntax option
limit_arg_precedence. - By default, double-quoted items are parsed as strings, not as character
lists. This behaviour can be changed via
set_chtab/2
which allows string-quotes, list-quotes and atom-quotes to be redefined.
- By default, consecutive string- or list-quotes have the effect of
concatenating the quoted items, while consecutive atom-quotes have
no special meaning. This can be changed by using the syntax option
doubled_quote_is_quote.
- By default, blank space between a sign and a number is significant:
When there is no space between sign and number, the sign is taken as
part of the number. With space, the sign is taken as prefix operator.
This is controlled by the syntax option blanks_after_sign.