ISO/IEC 13211-2:2000
(Main)Information technology — Programming languages — Prolog — Part 2: Modules
Information technology — Programming languages — Prolog — Part 2: Modules
This part of ISO/IEC 13211 is designed to promote the applicability and portability of Prolog modules that contain Prolog text complying with the requirements of the Programming Language Prolog as specified in this part of ISO/IEC 13211. This part of ISO/IEC 13211 specifies: a) The representation of Prolog text that constitutes a Prolog module, b) The constraints that shall be satisfied to prepare Prolog modules for execution, and c) The requirements, restrictions and limits imposed on a conforming Prolog processor that processes modules. This part of ISO/IEC 13211 does not specify: a) The size or number of Prolog modules that will exceed the capacity of any specific data processing system or language processor, or the actions to be taken when the limit is exceeded, b) The methods of activating the Prolog processor or the set of commands used to control the environment in which Prolog modules are prepared for execution, c) The mechanisms by which Prolog modules are loaded, d) The relationship between Prolog modules and the processor-specific file system. 1.1 Notes Notes in this part of ISO/IEC 13211 have no effect on the language, Prolog text, module text or Prolog processors that are defined as conforming to this part of ISO/IEC 13211. Reasons for including a note include: a) Cross references to other clauses and subclauses of this part of ISO/IEC 13211 in order to help readers find their way around, b) Warnings when a built-in predicate as defined in this part of ISO/IEC 13211 has a different meaning in some existing implementations.
Technologies de l'information — Langages de programmation — Prolog — Partie 2: Modules
General Information
Standards Content (Sample)
INTERNATIONAL ISO/IEC
STANDARD 13211-2
First edition
2000-06-01
Information technology — Programming
languages — Prolog —
Part 2:
Modules
Technologies de l'information — Langages de programmation — Prolog —
Partie 2: Modules
Reference number
ISO/IEC 13211-2:2000(E)
©
ISO/IEC 2000
---------------------- Page: 1 ----------------------
ISO/IEC 13211-2:2000(E)
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
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 parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 2000
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic
or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO's member body
in the country of the requester.
ISO copyright office
Case postale 56 � CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 734 10 79
E-mail copyright@iso.ch
Web www.iso.ch
Printed in Switzerland
ii © ISO/IEC 2000 – All rights reserved
---------------------- Page: 2 ----------------------
ISO/IEC 13211-2:2000(E)
Contents Page
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
1Scope :: :::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::1
1.1 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Normative reference :::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::1
3 Terms and definitions ::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::1
4 Compliance :: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::3
4.1 Prolog processor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 Module text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.3 Prolog goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.4 Prolog modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.4.1 Prolog text without modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.4.2 The module user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.5 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.5.1 Dynamic Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.5.2 Inaccessible Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5Syntax::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::4
5.1 Module text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2 Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
6 Language concepts and semantics ::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::::4
6.1 Related terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.1.1 Qualified and unqualified terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2 Module text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2.1 Module user . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2.2 Procedure Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2.3 Module interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2.4 Module directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6.2.5 Module body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.2.6 Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.3 Complete database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.1 Visible database . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.4 Context sensitive predicates. . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.4.1 Metapredicate built-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.4.2 Context sensitive built-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.4.3 Module name expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.4.4 Examples: Metapredicates . . . . . . . . . . . . . . . . . . . . . . . . 9
6.5 Converting a term to a clause, and a clause to a term . . . . . . . . . . . . . . . . . 10
6.5.1 Converting a term to the head of a clause . . . . . . . . . . . . . . . . . . . 10
6.5.2 Converting a module qualified term to a body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6.5.3 Converting the body of a clause to a term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.6 Executing a Prolog goal . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
iii
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 3 ----------------------
ISO/IEC 13211-2:2000(E)
6.6.1 Data types for the execution model . . . . . . . . . . . . . . . . . . . . . 12
6.6.2 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.6.3 Searching the complete database . . . . . . . . . . . . . . . . . . . . . . 13
6.6.4 Selecting a clause for execution. . . . . . . . . . . . . . . . . . . . . . . 13
6.6.5 Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.6.6 Executing a user-defined procedure: . . . . . . . . . . . . . . . . . . . . . 14
6.6.7 Executing a built-in predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.7 Executing a control construct . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.7.1 call/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.7.2 catch/3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.7.3 throw/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.8 Predicate properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.9 Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.9.1 Flag: colon sets calling context . . . . . . . . . . . . . . . . . . . . . . 16
6.10 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.10.1 Error classification. . . . . . . . . . . . . . . . . . . . . . . . . . 16
7 Built-in predicates::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: ::::: :::: :::: 16
7.1 The format of built-in predicate definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1.1 Type of an argument. . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.2 Module predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.2.1 current module/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.2.2 predicate property/2 . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.3 Clause retrieval and information . . . . . . . . . . . . . . . . . . . . . . . . 18
7.3.1 clause/2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.3.2 current predicate/1 . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.4 Database access and modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.4.1 asserta/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.4.2 assertz/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.4.3 retract/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.4.4 abolish/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
iv
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 4 ----------------------
ISO/IEC 13211-2:2000(E)
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized
system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International
Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and
IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in
liaison with ISO and IEC, also take part in the work.
International Standards are drafted in accordance with the rules given in the 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 International
Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard
requires 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 IEC
shall not be held responsible for identifying any or all such patent rights.
International 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 — Programming languages — Prolog:
� Part 1: General core
� Part 2: Modules
v
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 5 ----------------------
ISO/IEC 13211-2:2000(E)
Introduction
This 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 is recognized
not just as an important tool in AI (Artificial Intelligence) and expert systems, but as a general purpose high-level
programming language with some unique properties.
The language originates from work in the early 1970s by Robert A. Kowalski while at Edinburgh University (and ever
since at Imperial College, London) and Alain Colmerauer at the University of Aix-Marseilles in France. Their efforts
led in 1972 to the use of formal logic as the basis for a programming language. Kowalski’s research provided the
theoretical framework, while Colmerauer’s gave rise to the programming language Prolog. Colmerauer and his team then
built 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 be
made equal, and Prolog processors employ a search strategy which tries to find a solution to a problem by backtracking
to 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, and
also because the concept of backing out of an operation is built into the language. Prolog is also good for interactive
web applications because the language lends itself to both the production and analysis of text, allowing for production
of HTML ‘on the fly’.
This International Standard defines syntax and semantics of modules in ISO Prolog. There is no other International
Standard for Prolog modules.
Modules in Prolog serve to partition the name space and support encapsulation for the purposes of constructing large
systems out of smaller components. The module system is procedure-based rather than atom-based. This means that
each procedure is to be defined in a given name space. The requirements for Prolog modules are rendered more
complex by the existence of context sensitive procedures.
vi
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 6 ----------------------
INTERNATIONAL STANDARD ISO/IEC 13211-2:2000(E)
Information technology — Programming languages —
Prolog — Part 2: Modules
recent edition of the normative document indicated below. For
1Scope
undated references, the latest edition of the normative document
referred to applies. Members of ISO and IEC maintain registers of
This part of ISO/IEC 13211 is designed to promote the
currently valid International Standards.
applicability and portability of Prolog modules that contain
Prolog text complying with the requirements of the Programming
ISO/IEC 13211-1 : 1995, Information technology — Program-
Language Prolog as specified in this part of ISO/IEC 13211.
ming languages – Prolog Part 1: General core.
This part of ISO/IEC 13211 specifies:
a) The representation of Prolog text that constitutes a Prolog
3 Terms and definitions
module,
The terminology for this part of ISO/IEC 13211 has a format
b) The constraints that shall be satisfied to prepare Prolog
modeled on that of ISO 2382.
modules for execution, and
An entry consists of a phrase (in bold type) being defined,
c) The requirements, restrictions and limits imposed on a
followed by its definition. Words and phrases defined in the
conforming Prolog processor that processes modules.
glossary are printed in italics when they are defined in ISO/IEC
13211-1 or other entries of this part of ISO/IEC 13211. When
This part of ISO/IEC 13211 does not specify:
a definition contains two words or phrases defined in separate
entries directly following each other (or separated only by a
a) The size or number of Prolog modules that will exceed the
punctuation sign), * (an asterisk) separates them.
capacity of any specific data processing system or language
processor, or the actions to be taken when the limit is
Words and phrases not defined in the glossary are assumed to
exceeded,
have the meaning given in ISO 2382-15 and ISO/IEC 13211-1;
if they do not appear in ISO 2382-15 or ISO/IEC 13211-1, then
b) The methods of activating the Prolog processor or the
they are assumed to have their usual meaning.
set of commands used to control the environment in which
Prolog modules are prepared for execution,
A double asterisk (**) is used to denote those definitions where
there is a change from the meaning given in ISO/IEC 13211-1.
c) The mechanisms by which Prolog modules are loaded,
d) The relationship between Prolog modules and the
3.1 accessible procedure: See 3.39 – procedure, accessible.
processor-specific file system.
3.2 activation, of a procedure: A procedure has been
1.1 Notes activated when it is called for execution.
Notes in this part of ISO/IEC 13211 have no effect on the
3.3 argument, qualified: A qualified term which is an
language, Prolog text, module text or Prolog processors that are
argument in a module name qualified * predication.
defined as conforming to this part of ISO/IEC 13211. Reasons
for including a note include:
3.4 calling context: The set of visible procedures,the operator
a) Cross references to other clauses and subclauses of this
table, the character conversion mapping and Prolog flag values
part of ISO/IEC 13211 in order to help readers find their
denoted by a module name, and used as a context for activation
way around,
of a context sensitive procedure.
b) Warnings when a built-in predicate as defined in this part
of ISO/IEC 13211 has a different meaning in some existing
3.5 database, visible: The visible database of a module M
implementations.
is the set of procedures that can be activated without module
name qualification from within M.
2 Normative reference
3.6 defining module: See 3.23 – module, defining.
The following normative document contains provision which,
through reference in this text, constitute provisions of this part of
3.7 export: To make a procedure of an exporting module
ISO/IEC 13211. For dated references, subsequent amendments to,
available for import or re-export by other modules.
or revisions of, any of these publications do not apply. However,
parties to agreements based on this part of ISO/IEC 13211 are
encouraged to investigate the possibility of applying the most 3.8 exported procedure: See 3.41 – procedure, exported.
1
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 7 ----------------------
ISO/IEC 13211-2:2000(E)
3.9 import: To make procedures * exported or re-exported 3.25 module, existing: A module whose interface has been
by a module * visible in an importing or re-exporting module. prepared for execution (see 6.2.3).
3.10 import, selective: The importation into a module of only
3.26 module, exporting: A module that makes available
certain explicitly indicated procedures * exported or re-exported
procedures for import or re-export by other modules.
by a module (see 6.2.5.2).
3.27 module interface: A sequence of read-terms which
3.11 load (a module): Load the module interface of a module
specify the exported and re-exported procedures and exported *
and correctly prepare all its bodies,if any,for execution.
metapredicates of a module.
NOTE — The interface of a module shall be loaded before any body
of the module (see 6.2.3).
3.28 module, importing: A module into which procedures
are imported, adding them to the visible database of the module.
3.12 load (a module interface): Correctly prepare the module
interface of the module for execution.
3.29 module, lookup: The module where search for clauses
of a procedure takes place.
3.13 lookup module: See 3.29 – module, lookup.
NOTE — The lookup module defines the visible database of procedures
accessible without module name qualification (see 6.1.1.3).
3.14 meta-argument: An argument in a metaprocedure which
is context sensitive.
3.30 module name: An atom identifying a module.
3.15 metapredicate: A predicate denoting a metaprocedure.
3.31 module name qualification: The qualification of a term
3.16 metapredicate directive: A directive stipulating that a
with a module name.
procedure is a metapredicate.
3.32 module, qualifying: See 6.1.1.3 – Qualifying mod-
3.17 metapredicate mode indicator: Either a predicate indi-
ule, lookup module and defining module.
cator or a compound term each of whose arguments is ‘:’,or
‘*’ (see 6.1.1.4).
3.33 module, re-exporting: A module which, by re-
exportation,* imports certain procedures and exports these
3.18 metaprocedure: A procedure whose actions depend on
same procedures.
the calling context, and which therefore carries augmented
module information designating this calling context.
3.34 module text: A sequence of read-terms denoting direc-
3.19 metavariable: A variable occurring as an argument tives, module directives and clauses.
in a metaprocedure which will be subject to module name
qualification when the procedure is activated.
3.35 module, user: A module with name user containing
all user-defined procedures that are not specified as belonging
3.20 module: A named collection of procedures and directives
to a specific module.
together with provisions to export some of the procedures and
to import and re-export * procedures from other modules.
3.36 predicate **: An identifier or qualified identifier together
with an arity.
3.21 module body: A Prolog text containing the definitions
of the procedures of a module together with import and other
directives local to that module body.
3.37 predicate name, qualified: The qualified identifier of a
predicate.
3.22 module, calling (of a procedure): The module in which
a corresponding activator is executed.
3.38 preparation for execution: Implementation dependent
handling of both Prolog text and module text by a processor
which results, if successful, in the processor being ready to
3.23 module, defining: The module in whose module body
execute the prepared Prolog text or module text.
(or bodies) a procedure is defined explicitly and entirely.
3.24 module directive: A term D which affects the meaning 3.39 procedure, accessible: A procedure is accessible if it
of module text (6.2.4), and is denoted in that module text by a can be activated with module name qualification from any
directive-term :- (D). module which is currently loaded.
2
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 8 ----------------------
ISO/IEC 13211-2:2000(E)
3.40 procedure, context sensitive: A procedure is context 1) the requirements of this part of ISO/IEC 13211,
sensitive if the effect of its execution depends on the calling including the requirements set out in ISO/IEC 13211-1
context in which it is activated. General Core, whether or not the text makes explicit use
of modules, and
3.41 procedure, exported: A procedure that is made available
2) the implementation defined and implementation specific
by a module for import or re-export by other modules.
features of the Prolog processor,
b) Correctly execute Prolog goals which have been prepared
3.42 procedure, visible (in a module M): A procedure
for execution and which conform to:
that can be activated from M without using module name
qualification.
1) the requirements of this part of ISO/IEC 13211 and
ISO/IEC 13211, and
3.43 process **: Execution activity of a processor running
2) the implementation defined and implementation specific
prepared Prolog text and module text to manipulate conforming
features of the Prolog processor,
Prolog data, accomplish side effects and compute results.
c) Reject any Prolog text, module text or read-term whose
syntax fails to conform to:
3.44 prototype: A compound term where each argument is
a variable.
1) the requirements of this part of ISO/IEC 13211 and
ISO/IEC 13211, and
3.45 prototype, qualified: A qualified term whose first
argument is a module name and second argument is a prototype.
2) the implementation defined and implementation specific
features of the Prolog processor,
d) Specify all permitted variations from this part of ISO/IEC
3.46 qualification: The textual replacement (6.4.3) of a term
13211 and ISO/IEC 13211 in the manner prescribed by this
T by the term M:T where M is a module name.
part of ISO/IEC 13211 and ISO/IEC 13211, and
e) Offer a strictly conforming mode which shall reject the
3.47 qualified argument: See 3.3 – argument, qualified
use of an implementation specific feature in Prolog text,
module text or while executing a goal.
3.48 qualified term: See 3.51 – term, qualified.
4.2 Module text
3.49 re-export: To make procedures * exported by a module
Conforming module text shall use only the constructs specified
* visible in the re-exporting module, while at the same time
in this part of ISO/IEC 13211 and ISO/IEC 13211-1, and
making them available for import or re-export by other modules
the implementation defined and implementation specific features
from the re-exporting module.
supported by the processor.
3.50 re-export, selective: The re-exportation by a re-exporting Strictly conforming module text shall use only the constructs
* module of certain indicated procedures * exported from another specified in this part of ISO/IEC 13211 and ISO/IEC 13211-1,
module (see 6.2.4.3). and the implementation defined features specified by this part
of ISO/IEC 13211.
3.51 term, qualified: A term whose principal functor is
(:)/2.
4.3 Prolog goal
A conforming Prolog goal is one whose execution is defined
3.52 visible procedure (in a moduleM): See 3.42 – procedure,
by the constructs specified in this part of ISO/IEC 13211
visible.
and ISO/IEC 13211-1, and the implementation defined and
implementation specific features supported by the processor.
3.53 visible database (of a module M): See 3.5 – database,
A strictly conforming Prolog goal is one whose execution is
visible.
defined by constructs specified in this part of ISO/IEC 13211
and ISO/IEC 13211-1, and the implementation defined features
specified by this part of ISO/IEC 13211.
4 Compliance
4.4 Prolog modules
4.1 Prolog processor
4.4.1 Prolog text without modules
A conforming processor shall:
a) Correctly prepare for execution Prolog text and module A processor supporting modules shall be able to prepare and
text which conforms to: execute Prolog text that does not explicitly use modules. Such
3
© ISO/IEC 2000 – All rights reserved
---------------------- Page: 9 ----------------------
ISO/IEC 13211-2:2000(E)
Table 1 — The initial operator table
text shall be prepared and executed as the body of the required
built-in module named user.
Priority Specifier Operator(s)
1200 xfx :- -->
1200 fx :- ?-
4.4.2 The module user
1100 xfy ;
1050 xfy ->
A Prolog processor shall support a built-in module user.
1000 xfy ,
User-defined procedures not defined in any particular module
900 fy \+
shall belong to the module user.
700 xfx = \=
700 xfx == \== @< @=< @> @>=
700 xfx =.
4.5 Documentation
700 xfx is =:= =\= < =< > >=
600 xfy :
A conforming Prolog processor shall be accompanied by docu-
500 yfx +-/\\/
mentation that completes the definition of every implementation
400 yfx * / // rem mod << >>
defined implementation specific features (if any) specified in
200 xfx **
this part of ISO/IEC 13211and ISO/IEC 13211-1.
200 xfy ˆ
200 fy - \
4.5.1 Dynamic Modules
A Prolog processor may support additional implementation
Clause 6.2.4 defines the module directives and the module
specific procedures that support the creation or abolition of
interface directives. Clause 6.2.5 defines directives in addition
modules during execution of a Prolog goal.
to those of ISO/IEC 13211-1 that can appear in a module body
and their meanings.
4.5.2 Inaccessible Procedures
5.2 Terms
A Prolog processor may support additional features whose effect
is to make certain procedures defined in the body of a module
5.2.1 Operators
not accessible from outside the module.
The operator table specific to a module M defines which atoms
will be regarded as operators in the context of the given module
module M when (1) a sequence of tokens is parsed as a read-term
5Syntax
by the built-in predicate read term/3 or (2) Prolog text is
prepared for execution or (3) output by the built-in predicates
This clause defines the abstract syntax of Prolog text that
write term/3, write term/2, write/1, write/2,
supports modules. The notation is that of ISO/IEC 13211-1.
writeq/1, writeq/2.
Clause 5.1 defines the syntax of module text. Clause 5.2 defines
The effect of the directives op/3, char conversion/2
the role of the operator ‘:’.
and set prolog flag/2 in modules with multiple bodies is
described in 6.2.5.4.
5.1 Module text
Table 1 defines the predefined operators. The operator ‘:’ is
used for module qualification.
Module text is a sequence of read-terms which denote (1)
module directives, (2) interface directives, (3) directives, and (4)
NOTES
clauses of user-defined procedures.
1 This table is the same as table 7 of ISO/IEC
...
Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.