ImageVerifierCode 换一换
格式:PDF , 页数:207 ,大小:13.43MB ,
资源ID:436083      下载积分:10000 积分
快捷下载
登录下载
邮箱/手机:
温馨提示:
如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝扫码支付 微信扫码支付   
注意:如需开发票,请勿充值!
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【http://www.mydoc123.com/d-436083.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(ANSI INCITS ISO IEC 13211-1-1995 Information technology - Programming languages - Prolog - Part 1 General core.pdf)为本站会员(赵齐羽)主动上传,麦多课文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文库(发送邮件至master@mydoc123.com或直接QQ联系客服),我们立即给予删除!

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

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

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