ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf

上传人:赵齐羽 文档编号:436083 上传时间:2018-11-14 格式:PDF 页数:207 大小:13.43MB
下载 相关 举报
ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf_第1页
第1页 / 共207页
ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf_第2页
第2页 / 共207页
ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf_第3页
第3页 / 共207页
ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf_第4页
第4页 / 共207页
ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf_第5页
第5页 / 共207页
亲,该文档总共207页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、INTERNATIONAL STANDARD ISO/IEC 1321 l-l First edition 1995-06-01 Information technology - Programming languages - Prolog - Part 1: General core Technologies de /information - Langages de programmation - Prolog - Partie 7: Noyau g)/2 - disjunction 47 7.8.7 (-)/2 - if-then 49 7.8.8 (;)/2 - if-then-els

2、e 50 7.8.9 catch/3 51 7.8.10 throw/l . 53 7.9 Evaluating an expression. 54 7.9.1 Description . 54 7.9.2 Errors 54 7.10 Input/output. . 54 7.10.1 Sources and sinks 54 7.10.2 Streams . 55 7.10.3 Read-options list . 58 7.10.4 Write-options list 58 7.10.5 Writing a term 59 7.11 Flags 60 7.11.1 Flags def

3、ining integer type I 60 7.11.2 Other flags. 61 7.12 Errors. . 61 7.12.1 The effect of an error . 62 7.12.2 Error classification . 62 8 Built-in predicates 63 8.1 The format of built-in predicate definitions 63 8.1.1 Description . 63 8.1.2 Template and modes 64 8.1.3 Errors 64 iv ISO/IEC 1995 ISO/IEC

4、 13211-l : 1995(E) 81.4 Examples 8.1.5 Bootstrapped built-in predicates 8.2 Term unification. 8.2.1 (=)/2 - Prolog unify 8.2.2 unify-with-occurschecW2 - unify . 8.2.3 (=)/2 - not Prolog unifiable 8.3 Type testing . 8.3.1 var/l . 8.3.2 atom/l 8.3.3 integer/l . 8.3.4 float/l 8.3.5 atomic/l 8.3.6 compo

5、und/l 8.3.7 nonvarll . 8.3.8 number/l 8.4 Term comparison 8.4.1 (I=)/2 - term greater than, (=)/2 - term greater than or equal . 8.5 Term creation and decomposition. 8.5.1 functor/3 8.5.2 argJ3 . 8.5.3 (=)/ 2 - univ . 8.5.4 copy-term/2 8.6 Arithmetic evaluation . 8.6.1 (is)/2 - evaluate expression .

6、 8.7 Arithmetic comparison 8.7.1 (=:=)/2 - arithmetic equal, (=)/2 - arithmetic not equal, (c)/2 - arithmetic less than, (=)/2 - arithmetic greater than, (=)/2 - arithmetic greater than or equal 8.8 Clause retrieval and information . 8.8.1 clause/2 . 8.8.2 current-predicate/l 8.9 Clause creation and

7、 destruction 8.9.1 assertafl . 8.9.2 assertz/l . 8.9.3 retract/l . 8.9.4 abolish/l 8.10 All solutions . 8.10.1 findall/ . 8.10.2 bagoff . 8.10.3 setofl3 8.11 Stream selection and control 8.11.1 currentinput/l 8.11.2 current-output/l 8.11.3 set-input/l . 8.11.4 set-output/l 8.11.5 openl4, open/3 8.11

8、.6 close/2, close/l 8.11.7 flush-output/l, flush-output/O 8.11.8 stream_property/2, at-end-of-stream/O, at-end-of-stream/l . 8.11.9 set-stream-position/2 8.12 Character input/output 8.12.1 getcharl2, get-char/l, get-code/l, get-code/2 . 8.12.2 peek-charI2, peek-char/l, peek-code/l, peek-code12 65 65

9、 65 65 66 67 67 67 68 68 68 68 69 69 69 70 70 71 71 72 72 73 74 74 74 76 77 77 78 78 78 79 80 81 82 82 83 84 86 86 86 87 87 87 88 89 89 90 91 91 92 V ISO/IEC 13211-l : 1995(E) ISO/IEC 1995 8.12.3 put-charl2, put-char/l, put-code/l, put-codel2, nl/O, nl/l . 94 8.13 Byte input/output 95 8.13.1 get_byt

10、e/2, get-byte/l 95 8.13.2 peek-bytel2, peek-byte/l . 96 8.13.3 put-bytel2, put-byte/l . 97 8.14 Term input/output. . 98 8.14.1 read-terml3, read-termi2, read/l, read/2 . 98 8.14.2 write-terml3, write-terml2, write/l, writel2, writeqll, writeql2, write-canonical/l, write-canonical/2 . 99 8.14.3 op/3

11、101 8.14.4 current-op/3 102 8.14.5 char-conversion/2 103 8.14.6 current-char-conversion/2 . 103 8.15 Logic and control . 104 8.15.1 (+)/l - not provable . 104 8.15.2 once/l 105 8.15.3 repeat/O . 105 8.16 Atomic term processing . 105 8.16.1 atom-length/2 . 106 8.16.2 atom_concat/3 . 106 8.16.3 sub-at

12、om/5 . 107 8.16.4 atom-chars/:! 108 8.16.5 atom-codes/2 . 109 8.16.6 char-cede/2. 109 8.16.7 number-chars/2 110 8.16.8 number_codes/2. . 111 8.17 Implementation defined hooks . 112 8.17.1 setprologflag/:! . 112 8.17.2 currentprologflag/2 112 8.17.3 halt/O. 113 8.17.4 halt/l . 113 9 Evaluable functor

13、s . 9.1 The simple arithmetic functors . 9.1.1 Evaluable functors and operations 9.1.2 Exceptional values. 9.1.3 Integer operations and axioms 9.1.4 Floating point operations and axioms . 9.1.5 Mixed mode operations and axioms 9.1.6 Type conversion operations 9.1.7 Examples . 9.2 The format of other

14、 evaluable functor definitions . 9.2.1 Description 9.2.2 Template and modes . 9.2.3 Errors . 9.2.4 Examples . 9.3 Other arithmetic functors . 9.3.1 (*)/2 - power . 9.3.2 sin/l 9.3.3 cosll 9.3.4 atanll . 9.3.5 expll 9.3.6 log/l 9.3.7 sqrt/l 9.4 Bitwise functors 9.4.1 ()/2 - bitwise right shift. 9.4.2

15、 ( R, x R -+ B greater + RXR+R addition - RXR-+R subtraction ; RXR-R multiplication R x R + R division 4.1.3 Other functions 4.1.3.1 Substitution composition Signature: 0 : Substitution x Substitution -+ Substitution Axiom: f o g = h where h(x) = f(g(x) 4.1.3.2 1x1 - abs x Signature: 1 ) : R + R Axi

16、om: 1x1 = if x 0 then x else -2 4.1.3.3 1x1 - floor x The notation 1x1 designates the largest integer not greater than x. Signature: 1 1 : R -+ 2 Axiom: lx = n where (x - 1 0 then dx is the positive square root of x else undefined 4.1.3.6 Maximum of real set Signature: max : R-set + R Axiom: max(S)

17、= x if x E S A x 2 y for all y E S 4.1.3.7 Minimum of real set Signature: min : R-set -+ R Axiom: min(S) = 2 if x E S A z 5 y for all y E S 4.2 Abstract data type: stack For all a, a, b, 6 E T, m E MT, the following axioms shall apply: apply-mappingT(a, identity-mappingT) = a wh-maPPiWT(a, mappingT(

18、a, 6, m) = b if a = a = apply-mappingT( a, m) if a # a update-mappingT(a, b, identity-mappingT) = identity-mappingT if a = b = mappingT(a, b, identity_mappingT) if a # b update-mappingT(a, b, mappingT(a, b, m) = mappingT(a, b, update-mappingT(a, b, m) if a # a = mappingT(a, b, m) if a = a and a # b

19、=m if a = a and a = b NOTE - Convc (3.46) is a mapping. The following functions are specified for a stack So where D is a data type: 5 Compliance pushD : D X SD 4 SD topD : SD + D u el.TOr POpD : SD -f SD u error newstackD : -i SD isemptyD : SD -+ Boolean For all d E D, s E SD, the following axioms

20、shall apply: twD (Pusho (6 s) = d topD(newstUCkD) = error POPD (pusho (4 s) = s popD (newstackD) = error isemptyr (newstacko) = true isemptyD (pusho (d, s) = false NOTE - Stacks are used in the definition of executing a goal (7.7) and control constructs (7.8). 4.3 Abstract data type: mapping The fol

21、lowing functions are specified for a mapping MT where T is a data type: identity-mappingT : + MT ?nappingT : T X T X MT + MT apply-mappingT : T X MT + T update-mappingT : T x T x MT + MT 5.1 Prolog processor A conforming Prolog processor shall: a) Correctly prepare for execution Prolog text which co

22、nforms to: 1) the requirements of this part of ISO/IEC 13211, and 2) the implementation defined and implementation specific features of the Prolog processor, b) Correctly execute Prolog goals which have been prepared for execution and which conform to: 1) the requirements of this part of ISO/IEC 132

23、11, and 2) the implementation defined and implementation specific features of the Prolog processor, c) Reject any Prolog text or read-term whose syntax fails to conform to: 1) the requirements of this part of ISO/IEC 13211, and 2) the implementation defined and implementation specific features of th

24、e Prolog processor, 11 ISO/IEC 13211-1 : 1995(E) ISO/IEC 1995 d) Specify all permitted variations from this part of ISO/IEC 13211 in the manner prescribed by this part of ISO/IEC 132 11, and e) Offer a strictly conforming mode which shall reject the use of an implementation specific feature in Prolo

25、g text or while executing a goal. 5.2 Prolog text Conforming Prolog text shall use only the constructs speci- fied in this part of ISO/IEC 13211, and the implementation defined and implementation specific features supported by the processor. Strictly conforming Prolog text shall use only the con- st

26、ructs specified in this part of ISO/IEC 13211, and the implementation defined features supported by the processor. 5.3 Prolog goal A conforming Prolog goal is one whose execution is defined by the constructs specified in this part of ISO/IEC 132 11, and the implementation defined and implementation

27、specific features supported by the processor. A strictly conforming Prolog goal is one whose execution is defined by the constructs specified in this part of ISO/IEC 13211, and the implementation defined features supported by the processor. 5.4 Documentation A conforming Prolog processor shall be ac

28、companied by documentation that completes the definition of every implementation defined and implementation specific feature specified in this part of ISO/IEC 132 11. 5.5 Extensions A processor may support, as an implementation specific feature, any construct that is implicitly or explicitly undefin

29、ed in the part of ISO/IEC 13211. 5.5.1 Syntax A processor may support one or more additional char- acters in PCS (6.5) and additional syntax rules as an implementation specific feature iff: a) any sequence of tokens that conforms to the syntax of Prolog text and data defined in subclause 6.2 shall h

30、ave the abstract syntax defined in that subclause, b) any sequence of tokens that conforms to the syntax of a term defined in subclause 6.3 shall have the abstract syntax defined in that subclause, c) any sequence of characters that conforms to the syntax of Prolog tokens defined in subclause 6.4 sh

31、all be parsed to those Prolog tokens. NOTE - The presence of an infix and a postfix operator with the same priority is also an allowable extension as an implementation specific feature as long as, like any other syntax extension, it does not change the meaning of Prolog text which conforms to the st

32、andard. 5.5.2 Predefined operators A processor may support one or more additional predefined operators (table 7) as an implementation specific feature. 5.5.3 Character-conversion mapping A processor may support some other initial value of Convc, the character-conversion mapping (3.46), as an impleme

33、ntation specific feature. 5.5.4 Types A processor may support one or more additional types (7.1) as an implementation specific feature iff, for every additional type T supported by a processor: a) No term with type T shall also have a type T where T and T are different. b) For every two terms t and

34、t with types T and T respectively, t term-precedes t (7.2) shall depend only on T and T unless T = T. c) The processor shall define in its accompanying documentation the effect of converting a term of type T to a clause (7.6), and vice versa. d) The processor shall define in its accompanying documen

35、tation, the abstract and token syntax of every term of type T. e) The processor shall define in its accompanying documentation, the effect of evaluating as an expression a term of type T (7.9). f) The processor shall define in its accompanying documentation, the effect of writing a term of type T (7

36、.10). 12 ISO/IEC 1995 ISO/IEC 13211-1 : 1995(E) 5.5.5 Directives A processor may support one or more additional directive indicators (7.4.2) as an implementation specific feature. 5.5.6 Side effects A processor may support one or more additional side effects (7.7.9) as an implementation specific fea

37、ture. 5.5.7 Control constructs A processor may support one or more additional control constructs (7.8) as an implementation specific feature. 5.5.8 Flags A processor may support one or more additional flags (7.11) as an implementation specific feature. 5.5.9 Built-in predicates A processor may suppo

38、rt one or more additional built-in predicates (8) as an implementation specific feature. When a processor supports additional built-in predicates as an implementation specific feature, it may also support as an implementation specific feature one or more additional forms of Error-term (7.12.1). NOTE

39、 - The additional forms of Error-term may include for example =(N), between(N,M) and one-of (List) as valid domains. 5.5.10 Evaluable functors A processor may support one or more additional evaluable functors (9) as an implementation specific feature. A processor may support the value of an expressi

40、on being a value of an additional type instead of an exceptional value. NOTE - A program that makes no use of extensions should not rely on catching errors from procedures that evaluate their arguments (such as is/2, 8.6.1) unless it is executed in strictly conforming mode (5.1 e). 5.5.11 Reserved a

41、toms A processor may reserve some atoms for use in extensions. The effect of executing a goal whose execution causes a variable to be instantiated to a reserved atom or to a compound term whose functor name is a reserved atom is implementation defined. Table 3 - BS6154 syntactic metalanguage BS61.54

42、 symbol Meaning Unquoted characters Non-terminal symbol II II . . . Terminal symbol , I . . . Terminal symbol ( . . . ) Brackets . 1 Optional symbols 1 Symbols repeated zero or more times = Defining symbol i Rule terminator Alternative Concatenation t* . . . *) Comment 6 Syntax This clause defines t

43、he abstract and concrete syntaxes of a term, Prolog text and data. Terms are the data structures manipulated at runtime by a Prolog application. Subclause 6.2 defines how terms form Prolog text and data, subclause 6.3 defines how tokens are combined to form terms, and subclause 6.4 defines how seque

44、nces of characters form tokens. NOTES 1 The concept of a program is different in Prolog from that in many other programming languages. The closest equivalent concept in this part of ISO/IEC 13211 is the concept of “Prolog text”. 2 Different sequences of characters in Prolog text and data can have id

45、entical semantic meanings. The semantics is therefore based on an abstract syntax (6.1.2). 6.1 Notation 6.1.1 Backus Naur Form Syntax productions are written in a tabular notation, where the first line uses the extended BNF notation standardized as BS6154 and summarized in table 3. The metalanguage

46、symbols = 1 , are right-associative infix operators which bind increasingly tightly. The remaining lines of each syntax production link different attributes of each production and express context-sensitive constraints. Each entry can be considered as a parameter of a logical grammar (i.e. a definite

47、 clause or metamorphosis grammar). Parameters apply to non-terminal and terminal symbols. In these lines, variables are written in italic type 13 ISO/IEC 13211-1 : 1995(E) ISO/IEC 1995 style, and constants in typewriter type style. Each attribute of the grammar is on a separate line which is identif

48、ied at the start of the line. The facets of the term grammar are: Abstract - The abstract term or list of abstract terms associated with the non-terminal symbol defined by the syntax rule is specified in terms of the abstract elements of the symbols forming its definition. Priority - The context-sen

49、sitive aspects of the prece- dence grammars on which the Prolog operator notation is based. Each term and operator is associated with a priority, i.e. an integer between 0 and 1201. An atomic term and a compound term expressed in functional notation have a zero priority. A compound term expressed in operator notation (i.e. its principal functor occurs as an operator) has a priority which is equal to or greater than the priority of its principal functor (see 6.3.4.1). Specifier - The specifier of an operator (which defines its

展开阅读全文
相关资源
  • ANSI Z97 1-2009 American National Standard for Safety Glazing Materials used in Buildings - Safety Performance Specifications and Methods of Test《建筑物中窗用玻璃材料安全性用.pdfANSI Z97 1-2009 American National Standard for Safety Glazing Materials used in Buildings - Safety Performance Specifications and Methods of Test《建筑物中窗用玻璃材料安全性用.pdf
  • ANSI Z97 1 ERTA-2010 Re ANSI Z97 1 - 2009 Errata《修订版 美国国家标准学会Z97 1-2009标准的勘误表》.pdfANSI Z97 1 ERTA-2010 Re ANSI Z97 1 - 2009 Errata《修订版 美国国家标准学会Z97 1-2009标准的勘误表》.pdf
  • ANSI Z21 40 2a-1997 Gas-Fired Work Activated Air-Conditioning and Heat Pump Appliances (Same as CGA 2 92a)《燃气、工作激活空气调节和热泵器具(同 CGA 2 92a)》.pdfANSI Z21 40 2a-1997 Gas-Fired Work Activated Air-Conditioning and Heat Pump Appliances (Same as CGA 2 92a)《燃气、工作激活空气调节和热泵器具(同 CGA 2 92a)》.pdf
  • ANSI Z124 9-2004 American National Standard for Plastic Urinal Fixtures《塑料小便器用美国国家标准》.pdfANSI Z124 9-2004 American National Standard for Plastic Urinal Fixtures《塑料小便器用美国国家标准》.pdf
  • ANSI Z124 4-2006 American National Standard for Plastic Water Closet Bowls and Tanks《塑料抽水马桶和水箱用美国国家标准》.pdfANSI Z124 4-2006 American National Standard for Plastic Water Closet Bowls and Tanks《塑料抽水马桶和水箱用美国国家标准》.pdf
  • ANSI Z124 3-2005 American National Standard for Plastic Lavatories《塑料洗脸盆用美国国家标准》.pdfANSI Z124 3-2005 American National Standard for Plastic Lavatories《塑料洗脸盆用美国国家标准》.pdf
  • ANSI T1 659-1996 Telecommunications - Mobility Management Application Protocol (MMAP) RCF-RACF Operations《电信 可移动管理应用协议(MMAP) RCF-RACF操作》.pdfANSI T1 659-1996 Telecommunications - Mobility Management Application Protocol (MMAP) RCF-RACF Operations《电信 可移动管理应用协议(MMAP) RCF-RACF操作》.pdf
  • ANSI T1 651-1996 Telecommunications – Mobility Management Application Protocol (MMAP)《电信 可移动性管理应用协议》.pdfANSI T1 651-1996 Telecommunications – Mobility Management Application Protocol (MMAP)《电信 可移动性管理应用协议》.pdf
  • ANSI T1 609-1999 Interworking between the ISDN User-Network Interface Protocol and the Signalling System Number 7 ISDN User Part《电信 ISDN用户间网络接口协议和7号信令系统ISDN用户部分.pdfANSI T1 609-1999 Interworking between the ISDN User-Network Interface Protocol and the Signalling System Number 7 ISDN User Part《电信 ISDN用户间网络接口协议和7号信令系统ISDN用户部分.pdf
  • ANSI T1 605-1991 Integrated Services Digital Network (ISDN) - Basic Access Interface for S and T Reference Points (Layer 1 Specification)《综合服务数字网络(ISDN) S和T基准点的.pdfANSI T1 605-1991 Integrated Services Digital Network (ISDN) - Basic Access Interface for S and T Reference Points (Layer 1 Specification)《综合服务数字网络(ISDN) S和T基准点的.pdf
  • 猜你喜欢
    相关搜索

    当前位置:首页 > 标准规范 > 国际标准 > ANSI

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1