3

Java has a reference implementation.

Does ISO-Prolog have a reference implementation?

I do have INCITS/ISO/IEC 13211-1:1995 (R 2007) so no need to suggest that.

EDIT

Of note: Conformity Testing I: Syntax

false
  • 10,264
  • 13
  • 101
  • 209
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
  • Consider that Java has evolved from Java 1.0 in 1995 to Java 8.0 now, whereas ISO Prolog is still ISO Prolog. Standards are good for management, not so much for programming languages. – David Tonhofer Dec 25 '14 at 13:20
  • Also of interest: [Is the ISO Prolog standard taken seriously?](http://www.cs.unipr.it/~bagnara/Papers/Abstracts/ALPN99a) – David Tonhofer Dec 25 '14 at 14:17
  • Also related: Would you believe ... there is an [ISO LISP](https://en.wikipedia.org/wiki/ISLISP). – David Tonhofer Dec 25 '14 at 14:23
  • 2
    @DavidTonhofer: Please note that the link you quote was originally posted 1999-01-02 in comp.lang.prolog. In the meantime systems have improved quite a lot. SICStus is now most conforming. Also, the examples given are not entirely convincing. Take `name/2`, which is *not* ISO. Still, this polemic was very valuable as it helped to raise awareness. – false Dec 25 '14 at 15:05
  • @false Agree. Now, what one would actually need is a set of test cases that can be run against any implementation, like Java's [Technology Compatibility Kit](https://en.wikipedia.org/wiki/Technology_Compatibility_Kit) (the use of which is actually licensed by Oracle, I guess the money has to come from _somewhere_.) Is there a TCK for Prolog implementations? – David Tonhofer Dec 25 '14 at 16:56
  • 2
    @DavidTonhofer: There *has* been a conformance suite which was already part of the executable specification, it was later updated several times. The [final version](http://www.complang.tuwien.ac.at/ulrich/iso-prolog/#hu2006) is of 2006. However, the effect of this was very meager: A few systems took it seriously (SICStus, GNU), the others ignored it, because it was deemed "too complex". All newer comparisons are now in tables that are very easy to reproduce (case-by-case) and show concrete conformance. – false Dec 25 '14 at 17:11
  • @false Is there something more to the change of the name of the link than meets the eye? – Guy Coder Nov 18 '20 at 10:28
  • 1
    @GuyCoder: Conformity testing is the proper name. – false Nov 18 '20 at 10:34

4 Answers4

7

Let me first clarify what you mean by a reference implementation. You mean a sample implementation that is deemed to represent a valid interpretation of the standard. It is never clear what normative value such an implementation could have — think of the Java float syntax bug that made many systems loop.

There is no reference implementation for ISO Prolog. Like there is none for C, C++ or any other ISO/IEC standardized programming language. Please note that Java is not standardized by any standardization body like ISO, IEC, ITU nor CEN nor any national body like ANSI ; but rather by one company. And it is that very company that provides the reference implementation.

Also, Prolog exists since 1972 — long before any standardization took place. And it has been the first language of its kind and paradigm. It soon split into several different dialects with incompatible syntax (Prolog 1, Edinburgh, Prolog II etc.). One of the first standard related documents — Draft Proposed Standard for Prolog Evaluable Predicates by Richard O'Keefe was circulated 1984. BSI started 1984; AFNOR 1985. In 1987 the ISO process started, delivering ISO/IEC 13211-1 in 1995.

Contrast this to Java which evolved out of previous languages like C, C++ as well as other object oriented languages and inherited a lot from them. It had been developed quite differently with a company fiercely defending the language against all kinds of deviations — Think of it: even copies of the manuals were forbidden to be offered on the Internet.

In any case the Prolog systems with closest conformance are:

  1. SICStus Prolog 4.3 beta 1. Not known to misread any valid Prolog text. Full support of Cor.1, Cor.2.

  2. GNU Prolog 1.4.4 (git version). Not known to misread any valid Prolog text. Some differences in arithmetics. Otherwise Cor.1, Cor.2.

  3. IF/Prolog V5. The only system offering a strictly conforming mode (see ISO/IEC 13211-1:1995 subclause 5.1 e).

A concrete comparison w.r.t. syntax (reading and writing) gives you a bit of an impression of what you can expect from these and other implementations.

false
  • 10,264
  • 13
  • 101
  • 209
  • Where did you get the info to classify the Prologs by closest conformance? – Guy Coder Nov 21 '13 at 14:55
  • @GuyCoder: For Java see http://www.exploringbinary.com/why-volatile-fixes-the-2-2250738585072011e-308-bug/comment-page-1/#comment-4645 – false Nov 21 '13 at 15:01
  • @GuyCoder: I'd learn Prolog first, seriously. The best reference is SICStus. The second best GNU. Quite good is also Jekejeke - but it has some differences. – false Nov 21 '13 at 15:04
  • 1
    Yeah floats are always funny: Checkout X is 2.2250738585072011e-308 - 2.2250738585072012e-308 what is displayed: GNU Prolog: 0.0, SWI-Prolog -5.0e-324. Jekejeke Prolog: -4.9E-324 (or Hang when JDK 1.5 is used). –  Mar 28 '15 at 18:51
  • 1
    @j4nbur53: Recent GNU gives: -4.9406564584124654e-324 – false Mar 28 '15 at 21:25
  • 2
    GNU Prolog 1.4.4 gives 0.0 on Windows, and on Linux the number you were writing. You can also add a goal X==0, and get different results on Windows and Linux. On the other hand there is no difference for Jeke or SWI on Windows and Linux. –  Mar 28 '15 at 22:52
3

Another implementation that provides a strictly conforming mode is ECLiPSe.
Use it with the -L iso_strict command line option.

Quoting from the compliance statement:

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).

jschimpf
  • 4,904
  • 11
  • 24
2

No. But GNU Prolog follows the ISO Prolog Core standard quite closely. Also note that it provides a strict_iso flag.

There are also other Prolog compilers that provide good standard compliance.

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33
  • 1
    While GNU Prolog provides a `strict_iso` flag, this flag does not provide a strictly conforming mode in the sense of 5.1 e. – false Dec 26 '14 at 19:58
1

Directly from the SICStus Prolog manual, 4.3.0:

ISO Compliance

SICStus Prolog is fully compliant with the International Standard ISO/IEC 13211-1 (PROLOG: Part 1—General Core) as augmented by Technical Corrigenda 1 and 2.

To aid programmers who wish to write standard compliant programs, built-in predicates and arithmetic functors that are part of the ISO Prolog Standard are annotated with [ISO] in this manual.

Consider: The need to show compliance to a committee-issued technical document from 1995 except in a general way is hard to justify, unless you want to run a large amount of legacy code that cannot be updated for some reason. You want to run using modern ideas and features, not be compliant to premature normative references from ancient ages (when Sun workstations had 120 MHz CPUs and 24 MiB of RAM).

See also the chapter Positioning SWI-Prolog of the SWI Prolog manual.

In order to relieve people from searching, the list:

David Tonhofer
  • 14,559
  • 5
  • 55
  • 51
  • 2
    w.r.t "legacy" code. Please note that systems like SWI support syntax from 1976 which is no longer ISO conforming. Like the radix-notation for numbers: `2'100`. In ISO this is `0b100` only. See [#121](http://www.complang.tuwien.ac.at/ulrich/iso-prolog/conformity_assessment) – false Dec 25 '14 at 15:16
  • 1
    w.r.t your opinion on "the need to show compliance ...", please go to your national standardization member body and take an introductory course (1, 2 days) to understand what role compliance/conformance plays in various situations. SO is definitely not the place to discuss this. – false Dec 25 '14 at 23:50
  • @false Dontcha worry, I know about those things. Big Bucks therein lie. – David Tonhofer Dec 26 '14 at 02:03
  • 1
    Not sure you know when you write "... unless you run large amount of legacy code...". It's just one item in a long checklist, but ceteris paribus you are better off. Also, properties like having a canonical representation (newspeak: serialization format) are in itself an advantage. – false Dec 26 '14 at 13:53