1、Reference numberISO/IEC 13211-2:2000(E)ISO/IEC 2000INTERNATIONALSTANDARDISO/IEC13211-2First edition2000-06-01Information technology Programminglanguages Prolog Part 2:ModulesTechnologies de linformation Langages de programmation Prolog Partie 2: ModulesAdopted by INCITS (InterNational Committee for
2、Information Technology Standards) as an American National Standard.Date of ANSI Approval: 1/3/01Published by American National Standards Institute,25 West 43rd Street, New York, New York 10036Copyright 2002 by Information Technology Industry Council (ITI).All rights reserved.These materials are subj
3、ect to copyright claims of International Standardization Organization (ISO), InternationalElectrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council(ITI). Not for resale. No part of this publication may be reproduced in any form, incl
4、uding an electronic retrieval system, withoutthe prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaISO/IEC 13211-2:2000(E)PDF disclaimerThis PDF file may contain embedde
5、d typefaces. In accordance with Adobes licensing policy, this file may be printed or viewed but shall notbe edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading thisfile, parties accept therein the responsibility of not i
6、nfringing Adobes licensing policy. The ISO Central Secretariat accepts no liability in thisarea.Adobe is a trademark of Adobe Systems Incorporated.Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameterswere opti
7、mized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely eventthat a problem relating to it is found, please inform the Central Secretariat at the address given below. ISO/IEC 2000All rights reserved. Unless otherwise specified,
8、no part of this publication may be reproduced or utilized in any form or by any means, electronicor mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISOs member bodyin the country of the requester.ISO copyright officeCase postale
9、 56 Gb7 CH-1211 Geneva 20Tel. + 41 22 749 01 11Fax + 41 22 734 10 79E-mail copyrightiso.chWeb www.iso.chPrinted in Switzerlandii ISO/IEC 2000 All rights reservedISO/IEC 13211-2:2000(E)Contents PageForeword vIntroduction vi1ScopeBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM
10、BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 11.1 Notes. 12 Normative reference BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 13 Terms and definitions BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM
11、BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 14 Compliance BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 34.1 Prologprocessor. 34.2 Module text . . . . . . . . .
12、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.3 Prologgoal 34.4 Prolog modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.4.1
13、Prolog text without modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.4.2 The module user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44.5 Documentation 44.5
14、.1 Dynamic Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44.5.2 Inaccessible Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45SyntaxBMBMBMBMBM
15、BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 45.1 Module text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45.2 T
16、erms 45.2.1 Operators 46 Language concepts and semantics BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 46.1 Relatedterms. 56.1.1 Qualified and unqualified terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17、. . . . . . . . . . . 56.2 Module text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56.2.1 Module user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18、. . . . . . . . . . . . . 56.2.2 Procedure Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56.2.3 Module interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19、. . . . . . . . . 56.2.4 Module directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66.2.5 Module body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20、. . . . 76.2.6 Clauses 76.3 Completedatabase . 86.3.1 Visibledatabase . 86.3.2 Examples 86.4 Contextsensitive predicates. 86.4.1 Metapredicate built-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86.4.2 Context sensitive built-in
21、s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96.4.3 Module name expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96.4.4 Examples: Metapredicates 96.5 Convertingater
22、m toaclause, andaclause toaterm 106.5.1 Convertingaterm tothehead ofa clause 106.5.2 Converting a module qualified term to a body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106.5.3 Converting the body of a clause to a term . . . . . . . . . . . . . . . . . . . . .
23、. . . . . . . . . . . . . . . . . . . . . 116.6 ExecutingaProloggoal. 12iiiISO/IEC 2000 All rights reservedISO/IEC 13211-2:2000(E)6.6.1 Data types forthe executionmodel. 126.6.2 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24、 . . . . . . . . . . 126.6.3 Searchingthe complete database . 136.6.4 Selectingaclause forexecution 136.6.5 Backtracking 146.6.6 Executing auser-definedprocedure:. 146.6.7 Executing a built-in predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25、 . . 146.7 Executinga control construct . 146.7.1 call/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146.7.2 catch/3 156.7.3 throw/1 156.8 Predicate properties. 166.9 Flags . 166.9.1 Flag: colon sets callin
26、g context 166.10 Errors 166.10.1 Errorclassification 167 Built-in predicates BMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBMBM 167.1 The format of built-in predicate definitions . . . . . . . . . . . . . . . . . . . . .
27、 . . . . . . . . . . . . . . . . . . . . . . . . . . 167.1.1 Type of anargument 167.2 Module predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167.2.1 current module/1 . . . . . . . . . . . . . . . . . . . . .
28、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177.2.2 predicate property/2. 177.3 Clause retrievalandinformation . 187.3.1 clause/2 . 187.3.2 current predicate/1 197.4 Database access and modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29、. . . . . . . . . . . . . . . . . . . . . . 207.4.1 asserta/1 . 207.4.2 assertz/1 . 217.4.3 retract/1 . 217.4.4 abolish/1. 22iv ISO/IEC 2000 All rights reservedISO/IEC 13211-2:2000(E)vISO/IEC 2000 All rights reservedForewordISO (the International Organization for Standardization) and IEC (the Intern
30、ational Electrotechnical Commission) form the specializedsystem for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of InternationalStandards through technical committees established by the respective organization to deal with particular field
31、s of technical activity. ISO andIEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, inliaison with ISO and IEC, also take part in the work.International Standards are drafted in accordance with the rules given in th
32、e ISO/IEC Directives, Part 3.In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. Draft InternationalStandards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standardre
33、quires approval by at least 75 % of the national bodies casting a vote.Attention is drawn to the possibility that some of the elements of this part of ISO/IEC 13211 may be the subject of patent rights. ISO and IECshall not be held responsible for identifying any or all such patent rights.Internation
34、al Standard ISO/IEC 13211-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,Subcommittee SC 22, Programming languages, their environments and system software interfaces.ISO/IEC 13211 consists of the following parts, under the general title Information technology Progr
35、amming languages Prolog:Gbe Part 1: General coreGbe Part 2: ModulesISO/IEC 13211-2:2000(E)IntroductionThis is the first International Standard for Prolog, Part 2 (Modules). It was produced on May 1, 2000.Prolog (Programming in Logic) combines the concepts of logical and algorithmic programming, and
36、is recognizednot just as an important tool in AI (Artificial Intelligence) and expert systems, but as a general purpose high-levelprogramming language with some unique properties.The language originates from work in the early 1970s by Robert A. Kowalski while at Edinburgh University (and eversince a
37、t Imperial College, London) and Alain Colmerauer at the University of Aix-Marseilles in France. Their effortsled in 1972 to the use of formal logic as the basis for a programming language. Kowalskis research provided thetheoretical framework, while Colmerauers gave rise to the programming language P
38、rolog. Colmerauer and his team thenbuilt the first interpreter, and David Warren at the AI Department, University of Edinburgh, produced the first compiler.The crucial features of Prolog are unification and backtracking. Unification shows how two arbitrary structures can bemade equal, and Prolog pro
39、cessors employ a search strategy which tries to find a solution to a problem by backtrackingto other paths if any one particular search comes to a dead end.Prolog is good for windowing and multimedia because of the ease of building complex data structures dynamically, andalso because the concept of
40、backing out of an operation is built into the language. Prolog is also good for interactiveweb applications because the language lends itself to both the production and analysis of text, allowing for productionof HTML on the fly.This International Standard defines syntax and semantics of modules in
41、ISO Prolog. There is no other InternationalStandard for Prolog modules.Modules in Prolog serve to partition the name space and support encapsulation for the purposes of constructing largesystems out of smaller components. The module system is procedure-based rather than atom-based. This means thatea
42、ch procedure is to be defined in a given name space. The requirements for Prolog modules are rendered morecomplex by the existence of context sensitive procedures.vi ISO/IEC 2000 All rights reservedINTERNATIONAL STANDARD ISO/IEC 13211-2:2000(E)Information technology Programming languages Prolog Part
43、 2: Modules1ScopeThis part of ISO/IEC 13211 is designed to promote theapplicability and portability of Prolog modules that containProlog text complying with the requirements of the ProgrammingLanguage Prolog as specified in this part of ISO/IEC 13211.This part of ISO/IEC 13211 specifies:a) The repre
44、sentation of Prolog text that constitutes a Prologmodule,b) The constraints that shall be satisfied to prepare Prologmodules for execution, andc) The requirements, restrictions and limits imposed on aconforming Prolog processor that processes modules.This part of ISO/IEC 13211 does not specify:a) Th
45、e size or number of Prolog modules that will exceed thecapacity of any specific data processing system or languageprocessor, or the actions to be taken when the limit isexceeded,b) The methods of activating the Prolog processor or theset of commands used to control the environment in whichProlog mod
46、ules are prepared for execution,c) The mechanisms by which Prolog modules are loaded,d) The relationship between Prolog modules and theprocessor-specific file system.1.1 NotesNotes in this part of ISO/IEC 13211 have no effect on thelanguage, Prolog text, module text or Prolog processors that aredefi
47、ned as conforming to this part of ISO/IEC 13211. Reasonsfor including a note include:a) Cross references to other clauses and subclauses of thispart of ISO/IEC 13211 in order to help readers find theirway around,b) Warnings when a built-in predicate as defined in this partof ISO/IEC 13211 has a diff
48、erent meaning in some existingimplementations.2 Normative referenceISO/IEC 13211-1 : 1995, Information technology Program-ming languages Prolog Part 1: General core.3 Terms and definitionsThe terminology for this part of ISO/IEC 13211 has a formatmodeled on that of ISO 2382.An entry consists of a ph
49、rase (in bold type) being defined,followed by its definition. Words and phrases defined in theglossary are printed in italics when they are defined in ISO/IEC13211-1 or other entries of this part of ISO/IEC 13211. Whena definition contains two words or phrases defined in separateentries directly following each other (or separated only by apunctuation sign), * (an asterisk) separates them.Words and phrases not defined in the glossary are assumed tohave the meaning given in ISO 2382-15 and ISO/IEC 13211-1;if they do not appear in ISO 2382-15 or I
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1