Up Next

22.1  Using the compatibility language dialect

The ECLiPSe compatibility language dialects are the fastest way to get a program running that was originally written for a different system. To use a particular language dialect, a module should be created with that language dialect using module/3. The packages contain the necessary code to make ECLiPSe emulate the behaviour of the other system to a large extent within the module. Compatibility dialects exist for: See the Reference Manual for details on the compatibility provided by the language dialects. The language dialects are just modules which provides the necessary code and exports to emulate a particular Prolog dialect. This module is imported instead of the default eclipse_language dialect which provides the ECLiPSe language. The source code of the language dialect module is provided in the ECLiPSe library directory. Using this as a guideline, it should be easy to write similar packages for other systems, as long as their syntax does not deviate too much from the Edinburgh tradition.

The following problems can occur despite the use of compatibility packages:

22.1.1  Compiler versus Interpreter

If your program was written for an interpreter, e.g. C-Prolog, you have to be aware that ECLiPSe is a compiling system. There is a distinction between static and dynamic predicates. By default, a predicate is static. This means that its clauses have to be be compiled as a whole (they must not be spread over multiple files), its source code is not stored in the system, and it can not be modified (only recompiled as a whole). In contrast, a dynamic predicate may be modified by compiling or asserting new clauses and by retracting clauses. Its source code can be accessed using clause/1,2 or listing/0,1 A predicate is dynamic when it is explicitly declared as such or when it was created using assert/1. Porting programs from an interpreter usually requires the addition of some dynamic declarations. In the worst case, when (almost) all procedures have to be dynamic, the flag all_dynamic can be set instead.

Up Next