ECLiPSe and ISO-Prolog
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_strict option.
Any discrepancy from the declared level of compatibility is considered a bug.
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) and TC2 (2012).
We distinguish two main levels of compatibility:
- This aims to be fully ISO compliant, and also 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-conformant processor.
- A blend of ISO and ECLiPSe functionality. All ISO features are available, plus such ECLiPSe features that do not significantly conflict with ISO. But as some of these extensions go beyond what the letter of the standard allows, and because error checking can be less strict than required by ISO, this is not a fully compliant level.
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_strictcommand 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 a
-f <file>option to load an ISO-Prolog source file, and with a
-e <goal>option to execute a query.
If full ISO compliance is not required, 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
- 18.104.22.168 Character codes
- Each character maps to a corresponding byte
- 22.214.171.124 Characters
- As in the ISO 8859-1 character set
- 7.2.1 Variable term order
- Older variables precede newer variables
- 126.96.36.199,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
- 188.8.131.52 initialization/1
- Initialization goals are executed in the order in which they occur in the Prolog text
- 184.108.40.206 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)
- 220.127.116.11 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.
- 18.104.22.168 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
- 22.214.171.124 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.
- 126.96.36.199,11 Stream positions
- File, string, and null streams can be (re)positioned
- 188.8.131.52 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
- 184.108.40.206 Stream options
- The default eof_action is error
- 220.127.116.11 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)!
- 18.104.22.168 Stream options
- For additional stream options, see open/4
- 22.214.171.124 Options on stream closure
- 126.96.36.199 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
- The write predicates output extra spaces
- 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).