Вопрос

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

Это было полезно?

Решение

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.

Другие советы

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

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.

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:

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top