Next: Operators
Up: Syntax
Previous: Formal definition of clause
  Index
Subsections
Syntax Differences between ECLiPSe and other Prologs
Some particularities exist in the default syntax of ECLiPSe.
Most of these properties can be configured and are in fact changed
by the compatibility packages.
- Syntax for the special types of ECLiPSe: metaterms, rationals,
bounded reals and array subscript notation.
- by default, a blank space is allowed between the functor and the
following opening parenthesis (controlled by syntax option no_blanks)
- end of file is accepted as fullstop
- by default, operators with precedence higher than 1000 are allowed
in a comma-separated list of terms, i.e. structure arguments
and lists (controlled by syntax option limit_arg_precedence).
The ambiguity is resolved by considering commas
as argument separators rather than operators inside the term.
Thus e.g.
p(a :- b, c)
is accepted and parsed as p/2.
- double-quoted items are parsed as strings, not as lists
(controlled via set_chtab/2)
- empty brackets are not parsed as the atom '[]' when there are
layout charactes between the brackets (controlled by syntax option
blanks_in_nil)
Changing the Parser behaviour
Some of these properties can be changed by choosing one of the following
syntax_options.
The following options exist:
- blanks_in_nil
- allow blanks between the brackets in [].
- doubled_quote_is_quote
- parse a pair of quotes within a quoted item
as one occurrence of the quote within the string. If this option is off
(the default), consecutive string-quoted and list-quoted items are parsed
as a single (concatenated) item, and consecutive quoted atoms are parsed
as consecutive atoms.
- limit_arg_precedence
- do not allow terms with a precedence higher than 999 as
structure arguments, unless parenthesised.
- nested_comments
- allow bracketed comments to be nested.
- nl_in_quotes
- allow newlines to occur inside quotes.
- no_blanks
- do not allow blanks between functor an opening parenthesis
- iso_escapes
- ISO-Prolog compatible escape sequences within
strings and atoms.
- iso_base_prefix
- allow binary, octal or hexadecimal numbers to be written
with 0b, 0o or 0x prefix respectively, and disallow the
base'number
notation.
- $VAR
- terms of the form '$VAR'(N) are printed in a special way by all the
predicates that obey operator declarations (i.e. write, writeq, print
and partly printf). '$VAR'(0) is printed as A, '$VAR'(25) as Z,
'$VAR'(26) as A1 and so on.
When the argument is an atom or a string, just this argument is printed.
- based_bignums
- Allow base notation even to write integers longer than the wordsize
(i.e. they are always positive).
Syntax option settings can be local to a module or exported, e.g.
:- local syntax_option(not nl_in_quotes).
:- export syntax_option(no_blanks).
Next: Operators
Up: Syntax
Previous: Formal definition of clause
  Index
Warwick Harvey
2004-08-07