ECLiPSe and ISO-Prolog

Background

The "ECLiPSe Language" extends Prolog in a variety of ways, while aiming to preserve and strengthen its spirit. Forward-looking language evolution is a major part of our agenda. At the same time, ECLiPSe has a long history, predates the ISO-Prolog standard, and values stability and backward compatibility. ECLiPSe developers have in the past, and are at present, involved in formal and informal standardisation and language evolution efforts.

While we are committed to fully support the ISO Prolog Standard, the above considerations mean that ECLiPSe cannot just be an ISO-Prolog to the exclusion of everything else. Today, ECLiPSe includes a fully conforming ISO-Prolog Processor in the sense of the standard, and ECLiPSe can be used as a fully conforming pure ISO-Prolog when launched with the -L iso or -L iso_strict option. Any discrepancy from the declared level of compatibility is considered a bug.

Compliance Level

ECLiPSe provides an implementation of Standard Prolog as defined in ISO/IEC 13211-1 (Information Technology, Programming Languages, Prolog, Part 1, General Core, 1995) and the technical corrigenda ISO/IEC 13211-1 TC1 (2007), TC2 (2012), and TC3 (2017, since ECLiPSe 7.0).

We distinguish two main levels of compatibility:

iso_strict
This aims to be fully ISO compliant, and represents the 'strict mode' required by the ISO 13211-1 standard. This should be used for developing highly portable code, suitable for reuse on any ISO-conforming processor.
iso
This aims to be fully ISO compliant, but also includes ECLiPSe functionality that does not conflict with the standard. Note that in pre-7.0 ECLiPSe, this was not a fully compliant level.
See also details about syntax conformity (ECLiPSe 7.0 and later) and pre-7.0.

Usage

There are two ways of running ISO-Prolog programs with ECLiPSe. The first one is to contain or include the ISO-Prolog source in a module with a header directive like

    :- module(myisomodule, [], iso_strict).
where the last argument of the module/3 directive indicates the language. This module can then be compiled, and its initialization goals executed, using the normal ECLiPSe compilation and loading primitives (note that the standard itself does not define any compilation or loading primitives, nor any way to invoke queries besides initialization goals).

Alternatively, in order to use ISO-Prolog interactively, you can invoke eclipse with a

    -L iso_strict
command line option, or set the ECLIPSEDEFFAULTLANGUAGE environment variable to 'iso_strict'. This will launch eclipse with a default module accepting 'iso_strict' language instead of the usual 'eclipse_language'. Optionally, this can be combined with -f <file> options to load ISO-Prolog source files, and with a -e <goal> option to execute a query.

For non-strict ISO programs, use 'iso' instead of 'iso_strict'.

Specification of implementation defined features

The following is the specification of implementation-defined features stipulated by the standard.

6.5 Processor characted set
The PCS is the ISO 8859-1 character set. Classification of extended characters: 7f-a0 layout; a1-bf, d7, f7 graphic; c0-d6, d8-f6, f8-ff alphanumeric.
6.6 Collating sequence
The collating sequence is that of the ISO 8859-1 character set
7.1.2.2 Character codes
Each character maps to a corresponding byte
7.1.4.1 Characters
As in the ISO 8859-1 character set
7.2.1 Variable term order
Older variables precede newer variables
7.4.2.4,5 op/3 and char_conversion/2
An operator or character-conversion defined in a directive is effective at runtime, and only in the module in which it occurs
7.4.2.6 initialization/1
Initialization goals are executed in the order in which they occur in the Prolog text
7.4.2.7 include/1
The argument is a file name atom according to ECLiPSe's canonical file name syntax, or a term of the form library(atom)
7.4.2.8 ensure_loaded/1
The argument is a file name atom according to ECLiPSe's canonical file name syntax, or a term of the form library(atom). A file will be loaded on the first occurrence of ensure_loaded/1 in a prolog text, and if the file has been modified since the time it was first loaded.
7.4.2.7 set_prolog_flag/2
Flag setting are effective at runtime and globally (except for a few module-local flags in non-strict mode, see set_flag/2)
7.5.1 Preparing for execution
See the eclipse_language built-ins, menu items and command line options for compiling, loading and module handling, and also the instructions for using library(iso) or library(iso_strict)
7.7.1,3 Execution and Initialization
See the general ECLiPSe facilities, i.e. toplevel, graphical user interface and command line options
7.10.1 Sources and sinks
See open/3,4
7.10.2.6 Text streams
Text streams are very similar to binary streams, no characters are implicitly inserted or removed. The nl/0,1 predicates emit an operating system and device dependent newline sequence.
7.10.2.8,11 Stream positions
File, string, and null streams can be (re)positioned
7.10.2.9 End position of a stream
The end position of a stream is the same as the position that a character appended to the stream would have
7.10.2.11 Stream options
The default eof_action is error
7.10.2.13 Stream properties
File names are atoms according to ECLiPSe's canonical file name syntax.
7.11 Flags
Fixed values: bounded=false, min_integer and max_integer fail, integer_rounding_function=toward_zero, max_arity=unbounded, char_conversion=off. Default values: double_quotes=chars, debug=off. If debug=on, the ECLiPSe tracer is active. In non-strict mode, there is an additional flag max_predicate_arity, which indicates the limit on predicate arity (there is no limit on term arity).
7.12.1 Effect of an error
The implementation defined error term argument is normally the predicate indicator of the culprit goal. For syntax errors, it is a term describing the error location.
8.15.4 call/N
The maximum N is given by the flag max_predicate_arity (255)
8.17.1 set_prolog_flag/2
The admissible flag values are the ones defined by ISO-Prolog (for iso_strict), plus those accepted by ECLiPSe's set_flag/2 (for iso)
8.17.3,4 halt/0,1
Exits the OS process with the given return code (or 0)
9 Evaluable functors
The 'exceptional values' are realized as follows: 'float_overflow' leads to a floating point infinity result; 'underflow' leads to a floating point denormalized value result; 'zero_divisor' leads to a floating point infinity result in the case of floats, or an evaluation_error(zero_divisor) in the case of integers; 'int_overflow' does not occur and might lead to running out of memory instead.
9.3 Other arithmetic operations
When min/2 or max/2 are used with mixed integer and float arguments, the integer is coerced to float, and the result computed by comparing two floats
9.4 Bitwise arithmetic operations
The bitwise arithmetic operations behave as if operating on an unlimited length two's complement representation

Implementation specific features

These are only available with library(iso), not with library(iso_strict)!

7.10.2.11 Stream options
For additional stream options, see open/4
7.10.2.12 Options on stream closure
None
7.10.2.13 Stream properties
For additional stream properties, see get_stream_info/3
7.10.3 Read options
For additional read options, see read_term/3
7.10.4 Write options
For additional stream options, see write_term/3
7.11 Flags
For additional Prolog flags, see get_flag/2

Remaining deviations from Standard

  1. Floating-point arithmetic produces the 'exceptional values' that would be expected from the IEEE 754 standard rather than the evaluation errors still stipulated by the Prolog standard.
  2. The write predicates output extra spaces (pre-7.0 ECLiPSe only)
  3. The char_conversion flag is always off, meaning that character conversion is not applied to prolog texts or on term input. However, char_conversion/2 and current_char_conversion/2 predicates are operational.

The above details may be out of date, please see the current release documentation for library(iso_strict).