There is one standard and many systems. The standard fixes the core language; each system adds libraries, flags, a module system and data types, and some keep older behaviour the standard later changed. A source file does not say which system it is written for, so the viewer reads the syntax that all of them share and accepts the extras of each.
The ISO standard
| Document | What it covers |
|---|---|
| ISO/IEC 13211-1:1995 | the core: syntax (tokens, terms, operators, flags), the data model, the control constructs, about 100 built-in predicates, arithmetic and the error terms |
| ISO/IEC 13211-1:1995/Cor.1:2007 | the first technical corrigendum: corrections to the core, and new arithmetic functions |
| Cor.2:2012 | the second corrigendum: new built-in predicates (among them call/2 to call/8, false/0, callable/1, ground/1, retractall/1, subsumes_term/2, term_variables/2), more arithmetic (div) and conditional compilation directives |
| Cor.3 | a third corrigendum, with further corrections; the text is open as a draft on the conformity-testing pages |
| ISO/IEC 13211-2:2000 | modules; few systems implement it as written |
The standard text is sold by ISO; the corrigenda drafts, the conformity tests and the results for each system are open on Ulrich Neumerkel's pages. The details of each corrigendum above are the ones this site could confirm from those pages, and are given in outline.
The systems
| System | Files | What sets it apart |
|---|---|---|
| SWI-Prolog | .pl, .qlf compiled, .plt tests | the largest library; strings, dicts, quasi quotations, tabling, single-sided rules (=>), constraint handling rules, threads, a packs system; [] is not an atom in version 7 and later; a module system with operators local to modules |
| SICStus Prolog | .pl, .pro | commercial; a module system that many others imitate; block and mode declarations; CLP(FD), CHR; double-quoted text is a code list by default |
| GNU Prolog | .pl, .pro | compiles to native code with gplc; finite-domain constraint solver built in; no modules |
| YAP | .yap, .pl | fast; tabling; compatibility layers for SWI-Prolog and SICStus |
| XSB | .P, .xwam compiled | tabling (SLG resolution) with well-founded negation; HiLog; modules with :- export and :- import ... from |
| ECLiPSe | .ecl, .pl | constraint programming (finite domains, sets, reals), a string data type, modules with lib(Name); its own syntax extensions |
| Scryer Prolog | .pl | written in Rust, aims to follow ISO closely; double-quoted text is a list of characters by default; libraries written in pure Prolog (clpz, reif) |
| Trealla Prolog | .pl | small interpreter in C, runs as WebAssembly; follows ISO and adds strings and some SWI-Prolog features |
| Tau Prolog | .pl | runs in a browser and in Node.js; implements the ISO core and a growing set of libraries |
| Ciao | .pl | a language that grew from Prolog: modules, assertions and types, packages that change the syntax (:- use_package(...)) |
Where they differ in a source file
| Subject | ISO | Common extensions |
|---|---|---|
| double-quoted text | code list (flag double_quotes) | strings in SWI-Prolog 7 and later; character lists in Scryer Prolog; see Terms and operators |
| back-quoted text | a code list | controlled by the back_quotes flag in SWI-Prolog |
| numbers | decimal, 0'c, 0b 0o 0x, floats with a fraction | radix 16'FF, 1e10, digit groups, rationals, 1.0Inf |
| the empty list | the atom [] | a reserved constant in SWI-Prolog 7 and later |
| the list constructor | '.'/2 | '[|]'/2 in SWI-Prolog 7 and later, where '.' is used for dicts |
| modules | 13211-2 (rarely implemented) | the SICStus-style module/2 and use_module, with differences |
| tabling | none | :- table in SWI-Prolog, XSB, YAP, B-Prolog |
| rule forms | :- and --> | => (SWI-Prolog), CHR ==> and <=>, XSB and ECLiPSe own forms |
| conditional compilation | Cor.2: if, elif, else, endif | the same directives in most systems |
:- set_prolog_flag(double_quotes, codes).
vowel(C) :- memberchk(C, "aeiou").
greeting("hello").
Not described
Known, not yet covered
- Reference: the version history of each system (SWI-Prolog 5 to 9, SICStus 3 and 4, GNU Prolog 1.x, YAP 6 and 7) is not given, and the defaults of the flags in each version are not tabulated; the document list above is in outline.
- Reference: the differences of B-Prolog, Logtalk, Mercury, Visual Prolog, Amzi and other Prolog-like systems are not described.
- Viewer: the dialect of a file is not decided, so one scanner reads all of them; a construct that only one system accepts is coloured when it is found, and a construct that another system gives a different meaning to is not flagged.
Unknown
- Reference: the text of ISO/IEC 13211-1 and of 13211-2 is not public, and no Prolog system is installed here to check a claim by running it; statements about the standard come from the open drafts and conformity pages.