[ DCGs, Prolog prologue, Bigint Syntax, Cor.3/WDCor.3, Cor.2/DTC2, Cleanup, LIA, MOCSH/Unicode, ROK:[pllib, plstd] ]

# ISO Prolog works

Since 1995-06-01 the programming language Prolog has an ISO/IEC standard: 13211. Work is active since then and has regained momentum recently and ISO/IEC published Cor.3! If you are using Prolog or one of the hosted systems like CLP(FD) or CHR, join us in JTC1 SC22 WG17 (old site)!

Getting the document. Your national member body sells it for about USD 500. IHS Markit sells it for USD 60 as INCITS/ISO/IEC 13211-1. Other webstores: ANSI , SAI. The corrigenda Cor.1:2007, Cor.2:2012, and Cor.3:2017 are all free!

Here are current working documents for ISO/IEC JTC1 SC22 WG17 (Document register) l, from old place: l, l, l, l, l, l, l, l, l, l, l, l).

Comments welcome! If you have questions about the standard, don't hesitate to ask! If you ask your questions publicly, also others will profit! Use
Status Quo
Syntax for big integers
• _ (underscore) for separation proposed by Richard O'Keefe 2010-11-19 (6.0 Syntax. Numbers)
• (space) common notation, also required by ISO 31-0 (SI)
• SWI combines both
```integer constant (* 6.4.4 *)
= decimal digit char (* 6.5.2 *),
{ [ space char | digit separator ],
decimal digit char (* 6.5.2 *) } ;

binary constant (* 6.4.4 *)
= binary constant indicator (* 6.4.4 *),
binary digit char (* 6.5.2 *),
{ [ space char | digit separator ],
binary digit char (* 6.5.2 *) } ;

octal constant (* 6.4.4 *)
= octal constant indicator (* 6.4.4 *),
octal digit char (* 6.5.2 *),
{ [ space char | digit separator ],
octal digit char (* 6.5.2 *) } ;

hexadecimal constant (* 6.4.4 *)
= hexadecimal constant indicator (* 6.4.4 *),
hexadecimal digit char (* 6.5.2 *),
{ [ digit separator ],
hexadecimal digit char (* 6.5.2 *) } ;

digit separator
= underscore char (* 6.5.2 *),
[ layout text sequence (* 6.4.1 *) ] ;
```
Cor.3WDCor.3-WDR3 (N271): N258 Version 1.1 in Vienna. Draft for further corrigenda.
Published 2017-07-18 as ISO/IEC 13211-1:1995/Cor 3:2017.

Documents (N246 variable_names/1). N234, N250.

Prolog prologue
N235. A Prologue for Prolog.

The aim of this task is to identify and codify predicates for a prologue for Prolog like length/2.

DCGs
Test cases
Now version 1.18 of reference implementation (history).
N279 Draft 2019-06-03
N267 Draft 2015-11-10
N266 Draft 2015-08-31
N265 Draft 2015-07-30
N264 Draft 2015-05-06
N262 DIN Draft 2015-04-08
Now version 1.17 of reference implementation (history).
N261 DIN Draft 2014-08-31
N259' DIN Draft 2014-07-20
N259 DIN Draft 2014-07-18
N257 Comments on N253 DCGs draft 2014-04-08
Now version 1.16 of reference implementation (history).
N253 DIN Draft 2014-04-08
N249 DIN Draft 2013-08-20
N242 DIN Draft 2013-05-30
source
Comments on DCGs draft 2012-11-20
N238 DIN Draft 2012-11-20
Comments on DCGs draft 2012-07-13
Budapest 2012: DCG: N232 DIN Draft 2012-07-13, changes.
A simple reference implementation
Documents in Lexington
Comments on DCGs draft 2010-07-18
Comments on DCGs draft 2010-04-01
Historical reference implementations
• DCG.PL comp.lang.prolog posting 1988-07-28 by Richard O'Keefe
• TDCG.PL reportedly made public by Quintus in 1988
• expand.pl dcg.pl complang.prolog posting 1994-09-24
Documents explaining DCGs
Conformity testing I: Syntax.
Current differences between implementations. Please contribute!
Cor.2Draft Technical Corrigendum 2 (DCOR 2 vl. DTC2)
status quo. Incorporates N226, N225, N224 and partially N220 which all were partially based on N208. Submitted as ISO/IEC JTC1/SC 22 N4587 for DCOR ballot. Approved. Summary of voting N4603. Revised DCOR text submitted to ITTF for publication N4626. Published 2012-02-15 as ISO/IEC 13211-1:1995/Cor 2:2012.

Documents which were incorporated into DTC2:

A comparison of implementations of number_chars/2
This was the basis for fixing the error conditions.
Noname operators
Discussion paper, June 2010. Integrated into DTC2.
N226 An error class for unexpected instantiations
Action item in Pasadena. Delivered 2009-10-29 as N213, 2010-07-26 as N226, 2010-09-07 integrated into DTC2.
N225 Built-in predicates, current practice
Discussion paper, October 2009 - July 2010
N224 Evaluable functors, current practice
Discussion paper, October 2009 - July 2010
N220 Three steps to syntax harmony
Discussion paper, June 2010. Partially integrated into DTC2.
Syntax extension for |
Discussion paper, December 2009. This was the first step before N220.
Comments mostly on the unresolved issues of DTC1 with considerations for their inclusion into DTC2.
post-N215 setup_call_cleanup/3
Action item in Udine, 2008. Prepared for Pasadena, 2009 as N211. Further refinements due to Pasadena resolutions and user feedback. Delivered 2009-10-29 as N215. As of SE 7, 2011-07-28, Java has try-with-resources which suppresses exceptions in the same way as setup_call_cleanup/3.
Drafts at WG17 site

Documents by others related to Prolog standardization:
ISO/IEC 10967 Language independent arithmetic (vl. LIA).
The working group for this standard was WG11, documents. LIA consists of 3 parts:
LIA-1 Integer and floating point arithmetic.
The first edition of 1994-12-15 is now considered outdated. Already LIA-2 and LIA-3 are no longer based on it.

The second edition has been published 2012-07-11. The most recent publicly available draft is was N514.

Please note that the Prolog core standard (13211-1:1995) incorporates arithmetics according to a draft prior to 10967-1:1994. In the meantime, LIA-1 changed at least twice which makes following LIA-1 very difficult.

History of references to LIA-1:

Prolog docdaterefers toLIA docdate
1st CD N921992-03Language compatible arithmetic1st CD1991-03
2nd CD N1101993-03Language independent arithmetic - Part 12nd CD1992-08
DIS N1281994-03Language independent arithmetic - Part 1DIS1993-09
IS 13211-11995-06-01Language independent arithmetic - Part 1IS 10967-11994-12-15
LIA-2 Elementary numerical functions.
2001-08-15
LIA-3 Complex integer and floating point arithmetic and complex elementary numerical functions.
2006-05-01
Related resources:
• From William Kahan's article How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?
... As the population of computer programmers has grown, proficiency in rounding-error analysis has dwindled. To compensate, better diagnostic aids should be incorporated into hardware, into program development environments, and into programming languages; but this is not happening. Schemes to assist roundoff analysis are beset by failure modes; no scheme is foolproof; only two or three are worth trying. Alas, these few rely upon hardware features built into IEEE Standard 754 for binary floating-point but now atrophying for lack of adequate linguistic support. ...
• Unum number format by John Gustafson. My Unum page.
• The floating-point guide
ISO/IEC 11404:2007, General purpose datatypes.
2007
Multi-Octet Character Set Handling (MOCSH)
As a general remark note that in ISO/IEC 13211-1 there is a clean separation between characters and bytes. E.g., there is character I/O (8.12) and byte I/O (8.13). The processor character set PCS is implementation defined (6.5). This means, that conforming implementations may use ASCII, JIS, EBCDIC, ISO 8859-1, ISO 8859-5, Unicode, TRON, UTF-2000, GCS, GB 2312, GBK, GB 18030, or whatever other character set, provided
• this character set fulfills the requirements of 6.5 and 6.6, and
• the documentation accompanying the processor defines how the extended characters are mapped to Prolog syntax (6).
Some difficulties with understanding the problems related to Unicode are due to the so called Han unification. An account from the perspective of the TRON project. Unicode Angst in Japan and Asia.

Manually reordered index of charts.

Possible character classification schemes to consider:

Modules
There is a module standard: ISO/IEC 13211-2:2000.

Current contributions: ECLiPSe ModuleSystem. Previous versions: 2012-03-29

ISO Prolog standard and standards compliance of Prolog implementations
Improving the ISO Prolog standard by analyzing compliance test results by Péter Szabó and Péter Szeredi. Some suggestions are part of Cor.1 and Cor.2. Still some things to do for WDCor.3.
Prolog heritage
Is the ISO Prolog standard taken seriously? by Roberto Bagnara. [local copy]
An in the meanime outdated polemic originally posted 1999-01-02. At that time, it did not consider IF, Minerva, Prolog IV, nor GNU which at that time were already very much conforming. In the meantime systems have improved substantially, in particular SICStus.
Prolog compilers are too permissive by Paulo Moura.
An Elementary Prolog Library (vl. pllib) by Richard O'Keefe.
Previous drafts: 19', 19, 18'', 18', 18, 17, 15, 14, 12, 11', 11, 10', 10, 9, 8, 7B, 7A', 7A, 6, 5, 4, 4, 4, 4, 3, 2. Nota bene:
• Multiple versions of the same draft number are distinguished with '. Thus there is 7A and 7A'. 10 and 10'.
• As of version 18' of 2014-02-11, the document has not taken into account Cor. 2 (published 2012-02-15).

• 6.0 Syntax. (Numbers) (2010-11-19)
• 3. Sorting (Lists) (2011-12-08,-12)
• 3. Higher order list predicates (2012-06-07)
• 3. Higher order list predicates, Haskell, SML, Logtalk references (2012-06-19)
• 1.3 Normalisation (Unicode), case folding (12 2012-06-29)
• More posix (15)
• 10. Strings. (2013-12-17)
Content.
0. Introduction
0.1. Notation.
1. Characters.
1.1. Face reality, adopt Unicode, 1.2. `char_conversion` must go!, 1.3 Normalisation, 1.4. Character classification. is_unicode/2 and is_digit/2, 1.5. Character sets, 1.6. Case conversion. 1.7. Text Element Boundaries
2. Higher-order operations.
2.1. `call/`N, 2.2. `meta_predicate`, 2.3. Lambda, 2.4. Recommendations
3. Lists.
`append_append_length/7`, `reverse_append_length/4`, `permutation_length`, `pairs_keys_values/3`, Deletion, Sorting, Derived comparison predicate, Generalised sorting predicates, Locale-sensitive term ordering and sorting, Subsequences, Undone, Higher order list predicates, Linear scan for best value.
4. Sets
`ord_op/5`, Higher-order operations on sets
5. Queues
Higher order operations on queues
6. Numbers.
6.0. Syntax. 6.1. Comparison. 6.2. Additional predicates. 6.3 Division Predicates. 6.4 Additional Evaluable Functors.
7. Input/Output
7.1. Consulting Files, 7.2 Opening files by name, 7.3 Appending, 7.4 Positioning. Stream properties, `encoding`(EncName), `normalisation_form`(NF)
7. Streams.
7.1. Encoding, 7.2. User-defined stream properties, 7.3. Binary input/output, 7.4. UBF input/output, 7.5. Encryption, 7.6. Compression, 7.7. Network streams
8. Random numbers and data structures.
8.1 Random generator states. 8.2 Obtaining a random generator state. 8.3 Generating a list of random floats.
9. Files and Directories.
Running an external progam.
10. Strings.
A bad case for strings. The real case for strings. The case for conditional standardisation. Syntax. Predicates.
11. Not really the end.
1984 Draft Proposed Standard for Prolog Evaluable Predicates By Richard O'Keefe
Version by ok@goanna.cs.rmit.oz.au. source first announcement 1984-07-25. ECRC-Version (source).
There are many different places where comments by Joachim can be found. Some of them are even password protected.
Prolog and Standardisation
IsoErrata
Notes on the ISO-Prolog Standard
Previous drafts: 2013-12-09, 2011-04-24, 2011-04-12, 2010-09-27.

Remark that Joachim refers to various draft versions of Cor.2.

ISO-Prolog Syntax Compatibility
This labels #32, #34 as "debatable standard interpretation"
Core update float
Previous drafts: 2014-07-21, 2010-06-06, 2009-10-14.
Specs
CHR
Recently, there seems to be an interest in standardizing CHR.

Other standard related activity
Prolog portability quest. My attempt to vulgarize the ISO standard.

Validated HTML