1、BRITISH STANDARD BS ISO/IEC Part 1: General core Incorporating corrigenda February 2012 and November 2007 Information technology Programming languages Prolog Implementation of ISO/IEC 13211-1:1995 13211-1:1995 ICS 35.060National foreword This British Standard is the UK implementation of ISO/IEC 1321
2、1-1:1995 incorporating corrigenda November 2007 and February 2012. ISO/IEC technical corrigenda November 2007 and February 2012 have been appended to the end of this document in their entirety. The UK participation in its preparation was entrusted by Technical Committee IST/5, Programming languages,
3、 their environments and system software interfaces, to Subcommittee IST/5/-/17, Prolog. A list of organizations represented on this subcommittee can be obtained on request to its secretary. This publication does not purport to include all the necessary provisions of a contract. Users are responsible
4、 for its correct application. Compliance with a British Standard cannot confer immunity from legal obligations. BS ISO/IEC 13211-1:1995 This British Standard, having been prepared under the direction of the Information Systems Technology Assembly, was published under the authority of the Standards B
5、oard and comes into effect on 15 October 1995 The British Standards Institution 2012. Published by BSI Standards Limited 2012. Amendments/corrigenda issued since publication Date Comments 31 March 2012 Implementation of ISO/IEC corrigendum November 2007 and February 2012 ISBN 978 0 580 74320 7BS ISO
6、/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/
7、IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/I
8、EC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IE
9、C 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC
10、 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC
11、13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 1
12、3211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13
13、211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 132
14、11-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 1321
15、1-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211
16、-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-
17、1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1
18、:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:
19、1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1
20、995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:19
21、95BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995BS ISO/IEC 13211-1:1995ICS 35.060.00 Ref. No.
22、 ISO/IEC 13211-1:1995/Cor.1:2007(E) ISO/IEC 2007 All rights reserved Published in Switzerland INTERNATIONAL STANDARD ISO/IEC 13211-1:1995 TECHNICAL CORRIGENDUM 1 Published 2007-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION ORGANISATION INTERNATIONALE DE NORMALISATION INTERNATIONAL ELECTROTECH
23、NICAL COMMISSION COMMISSION LECTROTECHNIQUE INTERNATIONALEInformation technology Programming languages Prolog Part 1: General core TECHNICAL CORRIGENDUM 1 Technologies de linformation Langages de programmation Prolog Partie 1: Noyau gnral RECTIFICATIF TECHNIQUE 1 Technical Corrigendum 1 to ISO/IEC 1
24、3211-1:1995 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces NOTE Some text in Mathematical font is expressed using Latex convention, i.e. surrounded with $ signs. 3.106 mappi
25、ng mapping is used with a second meaning in the standard: add a second definition A function from a value of one type $T$ to a value of another type $R$ denoted by $T rightarrow R$ BS ISO/IEC 13211-1:1995ISO/IEC 13211-1:1995/Cor.1:2007(E) 2 ISO/IEC 2007 All rights reserved3.108 most general unifier
26、(MGU) Replace instance by example because instance is not being used with the meaning defined in 3.95. 3.125 partial list Replace A variable by A variable. Replace second argument by second argument. 3.148 read-term Replace end token. by end token. 4.1.3.5 Axiom Replace: Axiom: if x 0 then x is the
27、positive square root of x else undefined. by Axiom: if x 0 then x is the non-negative square root of x else undefined. 6.3.7 Term - double quoted list notation If a double quoted list represents an atom (i.e. the Prolog flag double_quotes has value atom), the priority of the term should depend on wh
28、ether or not the atom is an operator as in 6.3.1.3. ISO/IEC 13211-1 states that the priority of an atom represented by a double quoted list is always zero. Replace the syntax rule by the four syntax rules: term = double quoted list ; Abstract: l dql Priority: 0 Condition: Prolog flag double_quotes h
29、as value chars term = double quoted list ; Abstract: l dql Priority: 0 Condition: Prolog flag double_quotes has value code atom = double quoted list ; Abstract: a dql Priority: n Condition: Prolog flag double_quotes has value atom Condition: a is an operator atom = double quoted list ; Abstract: a d
30、ql Priority: 0 Condition: Prolog flag double_quotes has value atom Condition: a is not an operator 7.2.5 c) 2) Replace 2) if XN is the . by 2) XN is the . 7.8.5.4 Replace the first sentence: Tables 27 and 28 show the execution stack before and after executing the control construct ,(First, second).
31、by Tables 27 and 28 show the execution stack before and after executing the control construct ,(First, Second). BS ISO/IEC 13211-1:1995ISO/IEC 13211-1:1995/Cor.1:2007(E) ISO/IEC 2007 All rights reserved 3Table 35 line 2 Replace (else(W), CP) by (Else, CP) 7.8.8.4 last example Replace ;(-(!,fail), tr
32、ue), true). by ;(-(!,fail), true), true). 7.9.2 Add additional errors: i) The value of an argument Culprit is not a member of the set $I$ - type_error(integer, Culprit) j) The value of an argument Culprit is not a member of the set $F$ - type_error(float, Culprit) 9.1.7 example no. 35 shows these er
33、rors are required. 7.12.2 i) Twice replace imp_dep_atom by Imp_dep_atom 8.8.1.1 d) Replace Chooses the first element of the list L by Chooses the first element of the list L, unifies it with the term clause(Head,Body) Similarly for f). 8.9.4.1 abolish/1: Description In the note, replace procedures i
34、dentified by procedure identified. 8.10.3.4 example no. 20 Replace a, b, f(b), f(a) by a, b, f(a), f(b) BS ISO/IEC 13211-1:1995ISO/IEC 13211-1:1995/Cor.1:2007(E) 4 ISO/IEC 2007 All rights reserved8.13.3.4 put_byte/1 Replace put_byte(84). If the current output stream contains ., 113,119,101,114 Succe
35、eds, and leaves that stream ., 113,119,101,114,116 put_byte(st_o, 84). If the stream associated with st_o contains ., 113,119,101,114 Succeeds, and leaves that stream ., 113,119,101,114,116 by put_byte(84). If the current output stream contains ., 113,119,101,114 Succeeds, and leaves that stream .,
36、113,119,101,114,84 put_byte(st_o, 116). If the stream associated with st_o contains ., 113,119,101,114 Succeeds, and leaves that stream ., 113,119,101,114,116 8.14.1.4 examples no. 2 and 3 Replace st_o by st_i 8.14.1.4 example no. 6 (last) Replace The current input stream is left with position past-
37、end-of-stream. by The current input stream is left in an undefined state. (Cf. 8.14.1.1 NOTE 2) 8.14.4.1 d) Replace Chooses a member of $Set_Op$ and the goal succeeds by Chooses a member of $Set_Op$, unifies it with (Priority, Op_specifier, Operator), and the goal succeeds 8.16.4 atom_chars/2 The si
38、xth example in 8.16.4.4 is atom_chars(North, N | X). Succeeds, unifying X with o, r, t, h. but the procedural description does not permit this. Replace 8.16.4.1(c) by: c) Else if Atom is an atom whose name is the sequence of characters $Seq$ and List unifies with a list L such that every element of
39、L is the one-char atom whose name is the corresponding element of $Seq$, then the goal succeeds, 8.16.5 atom_codes/2 The error noted in 8.16.4 implies a similar change in this procedure. Replace 8.16.5.1(c) by: c) Else if Atom is an atom whose name is the sequence of characters $Seq$ and List unifie
40、s with a list L such that every element of L is the character code of the corresponding element of $Seq$, then the goal succeeds, BS ISO/IEC 13211-1:1995ISO/IEC 13211-1:1995/Cor.1:2007(E) ISO/IEC 2007 All rights reserved 59.1.4.1 Add a note pointing to the definition of F* (7.1.3.1). 9.1.7 example n
41、o. 21 Replace /(7, 35) by /(7, 35) 9.1.7 example no. 23 Replace /(140, 3+11) by /(140, 3+11) 9.1.7 example no. 24 Replace 14.200 by 1.4200 9.1.7 example no. 48 Replace float(5/3) by float(5/3) 9.3.5.4 example no. 2 9.3.6.4 example no. 2 Replace 2.7818 by 2.71828 9.4.1.4 example no. 5, 9.4.2.4 exampl
42、e no. 5. 9.4.3.4 example no. 6, 9.4.4.4 example no. 6 Replace type(integer,foo) by type_error(evaluable,foo/0) BS ISO/IEC 13211-1:1995 INTERNATIONAL STANDARD ISO/IEC 13211-1:1995 TECHNICAL CORRIGENDUM 2 Published 2012-02-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION ORGANISATION INTERNATIONALE D
43、E NORMALISATION INTERNATIONAL ELECTROTECHNICAL COMMISSION COMMISSION LECTROTECHNIQUE INTERNATIONALEInformation technology Programming languages Prolog Part 1: General core TECHNICAL CORRIGENDUM 2 Technologies de linformation Langages de programmation Prolog Partie 1: Noyau gnral RECTIFICATIF TECHNIQ
44、UE 2 Technical Corrigendum 2 to ISO/IEC 13211-1:1995 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces. ICS 35.060 Ref. No. ISO/IEC 13211-1:1995/Cor.2:2012(E) ISO/IEC 2012 All
45、rights reserved Published in Switzerland BS ISO/IEC 13211-1:1995 ISO/IEC 2012 All rights reserved Information technology - Programming languages - Prolog - Part 1: General Core TECHNICAL CORRIGENDUM 2 Allow bar character | as infix operator, forbid and as operators. 6.3.4.3 Operators Add prior to sy
46、ntax rules: A bar (6.4) shall be equivalent to the atom | when | is an operator. Add the syntax rule: op = bar ; Abstract: | Priority: n n Specifier: s s Condition: | is an operator Add at the end of 6.3.4.3 before NOTES: There shall not be an operator or . An operator | shall be only an infix opera
47、tor with priority greater than or equal to 1001. Add to note 1 Bar is also a solo character (6.5.3), and a token (6.4) but not an atom. Replace note 3 3 The third argument of op/3 (8.14.3) may be any atom except , so the priority of the comma operator cannot be changed. by 3 The third argument of op
48、/3 (8.14.3) may be any atom except , , and so the priority of the comma operator cannot be changed, and so empty lists and curly bracket pairs cannot be declared as operators. 6.3.4.4 BS ISO/IEC 13211-1:1995Add in Table 7 - The operator table: Priority Specifier Operator(s) 400 yfx div 200 fy + 6.4 Tokens Add as the last syntax rule: bar (* 6.4 *) = layout text sequence (* 6