1、 INCITS/ISO/IEC 9496:20032010 (ISO/IEC 9496:2003, IDT) CHILL - The ITU-T programming language Reaffirmed as INCITS/ISO/IEC 9496:2003 R2015INCITS/ISO/IEC 9496:20032010 PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or
2、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 Adobes licensing policy. The ISO Central Secretariat accepts no liability
3、 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 suitab
4、le 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. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 1
5、1/18/2010 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Copyright 2010 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), Inter
6、national Electrotechnical 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, including an electronic retrieval system, without the prior written permission of IT
7、I. All requests pertaining to this standard should be submitted to ITI, 1101 K Street NW, Suite 610, Washington DC 20005. Printed in the United States of America ii ITIC 2010 All rights reserved ISO/IEC 9496:2003(E) ISO/IEC 2003 All rights reserved iiiCONTENTS Page 1 Introduction 1 1.1 General 1 1.2
8、 Language survey . 1 1.3 Modes and classes . 2 1.4 Locations and their accesses . 3 1.5 Values and their operations . 3 1.6 Actions 4 1.7 Input and output 4 1.8 Exception handling 4 1.9 Time supervision. 5 1.10 Program structure 5 1.11 Concurrent execution 5 1.12 General semantic properties 6 1.13 I
9、mplementation options. 6 2 Preliminaries. 7 2.1 The metalanguage . 7 2.2 Vocabulary 8 2.3 The use of spaces 9 2.4 Comments . 9 2.5 Format effectors 9 2.6 Compiler directives . 10 2.7 Names and their defining occurrences 10 3 Modes and classes. 12 3.1 General 12 3.2 Mode definitions . 13 3.3 Mode cla
10、ssification . 16 3.4 Discrete modes 17 3.5 Real modes 20 3.6 Powerset modes. 22 3.7 Reference modes . 22 3.8 Procedure modes . 23 3.9 Instance modes 24 3.10 Synchronization modes . 25 3.11 Input-Output Modes 26 3.12 Timing modes . 28 3.13 Composite modes 29 3.14 Dynamic modes. 37 3.15 Moreta Modes .
11、 38 4 Locations and their accesses . 45 4.1 Declarations 45 4.2 Locations. 47 5 Values and their operations. 54 5.1 Synonym definitions . 54 5.2 Primitive value 55 5.3 Values and expressions . 70 ISO/IEC 9496:2003(E) iv ISO/IEC 2003 All rights reservedPage 6 Actions 79 6.1 General 79 6.2 Assignment
12、action. 79 6.3 If action . 81 6.4 Case action 81 6.5 Do action. 83 6.6 Exit action . 86 6.7 Call action . 87 6.8 Result and return action. 90 6.9 Goto action 90 6.10 Assert action 91 6.11 Empty action . 91 6.12 Cause action 91 6.13 Start action 91 6.14 Stop action. 91 6.15 Continue action . 92 6.16
13、Delay action 92 6.17 Delay case action. 92 6.18 Send action 93 6.19 Receive case action . 94 6.20 CHILL built-in routine calls 97 7 Input and Output. 102 7.1 I/O reference model. 102 7.2 Association values. 104 7.3 Access values 104 7.4 Built-in routines for input output. 105 7.5 Text input output.
14、112 8 Exception handling . 120 8.1 General 120 8.2 Handlers 121 8.3 Handler identification 121 9 Time supervision 122 9.1 General 122 9.2 Timeoutable processes 122 9.3 Timing actions. 122 9.4 Built-in routines for time. 124 10 Program Structure. 125 10.1 General 125 10.2 Reaches and nesting 127 10.3
15、 Begin-end blocks. 129 10.4 Procedure specifications and definitions. 129 10.5 Process specifications and definitions. 134 10.6 Modules. 134 10.7 Regions 135 10.8 Program. 135 10.9 Storage allocation and lifetime 136 10.10 Constructs for piecewise programming. 136 10.11 Genericity 141 ISO/IEC 9496:2
16、003(E) ISO/IEC 2003 All rights reserved vPage 11 Concurrent execution 144 11.1 Processes, tasks, threads and their definitions. 144 11.2 Mutual exclusion and regions . 145 11.3 Delaying of a thread 148 11.4 Re-activation of a thread . 148 11.5 Signal definition statements 148 11.6 Completion of Regi
17、on and Task locations 149 12 General semantic properties 149 12.1 Mode rules. 149 12.2 Visibility and name binding 160 12.3 Case selection 167 12.4 Definition and summary of semantic categories . 169 13 Implementation options 173 13.1 Implementation defined built-in routines 173 13.2 Implementation
18、defined integer modes . 173 13.3 Implementation defined floating point modes. 173 13.4 Implementation defined process names 173 13.5 Implementation defined handlers 173 13.6 Implementation defined exception names. 173 13.7 Other implementation defined features . 173 Appendix I Character set for CHIL
19、L 175 Appendix II Special symbols 176 Appendix III Special simple name strings 177 III.1 Reserved simple name strings . 177 III.2 Predefined simple name strings. 178 III.3 Exception names . 178 Appendix IV Program examples. 179 IV.1 Operations on integers. 179 IV.2 Same operations on fractions 179 I
20、V.3 Same operations on complex numbers 180 IV.4 General order arithmetic 180 IV.5 Adding bit by bit and checking the result 180 IV.6 Playing with dates . 181 IV.7 Roman numerals 182 IV.8 Counting letters in a character string of arbitrary length. 183 IV.9 Prime numbers 184 IV.10 Implementing stacks
21、in two different ways, transparent to the user 184 IV.11 Fragment for playing chess . 185 IV.12 Building and manipulating a circularly linked list 188 IV.13 A region for managing competing accesses to a resource. 189 IV.14 Queuing calls to a switchboard . 190 IV.15 Allocating and deallocating a set
22、of resources 190 IV.16 Allocating and deallocating a set of resources using buffers 192 IV.17 String scanner1 194 IV.18 String scanner2 195 IV.19 Removing an item from a double linked list . 196 IV.20 Update a record of a file 196 IV.21 Merge two sorted files. 197 IV.22 Read a file with variable len
23、gth records 198 IV.23 The use of spec modules . 199 IV.24 Example of a context. 199 IV.25 The use of prefixing and remote modules . 199 ISO/IEC 9496:2003(E) vi ISO/IEC 2003 All rights reservedPage IV.26 The use of text i/o 200 IV.27 A generic stack 201 IV.28 An abstract data type. 202 IV.29 Example
24、of a spec module 202 IV.30 Object-Orientation: Modes for Simple, Sequential Stacks 202 IV.31 Object-Orientation: Mode Extension: Simple, Sequential Stack with Operation “Top“. 204 IV.32 Object-Orientation: Modes for Stacks with Access Synchronization 204 Appendix V Decommitted features. 206 V.1 Free
25、 directive. 206 V.2 Integer modes syntax. 206 V.3 Set modes with holes. 206 V.4 Procedure modes syntax 206 V.5 String modes syntax 207 V.6 Array modes syntax. 207 V.7 Level structure notation. 207 V.8 Map reference names 207 V.9 Based declarations. 207 V.10 Character string literals . 207 V.11 Recei
26、ve expressions 207 V.12 Addr notation 207 V.13 Assignment syntax 207 V.14 Case action syntax. 207 V.15 Do for action syntax 207 V.16 Explicit loop counters . 208 V.17 Call action syntax 208 V.18 RECURSEFAIL exception . 208 V.19 Start action syntax. 208 V.20 Explicit value receive names. 208 V.21 Blo
27、cks . 208 V.22 Entry statement 208 V.23 Register names 208 V.24 Recursive attribute 208 V.25 Quasi cause statements and quasi handlers . 209 V.26 Syntax of quasi statements 209 V.27 Weakly visible names and visibility statements 209 V.28 Weakly visible names and visibility statements 209 V.29 Pervas
28、iveness 209 V.30 Seizing by modulion name 209 V.31 Predefined simple name strings. 209 Appendix VI Index of production rules 210 ISO/IEC 9496:2003(E) ISO/IEC 2003 All rights reserved viiForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Comm
29、ission) 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. IS
30、O 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. In the field of information technology, ISO and IEC have established a joint technical committee, IS
31、O/IEC JTC 1. International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2. The main task of the joint technical committee is to prepare International Standards. Draft International Standards adopted by the technical committee are circulated to the member b
32、odies for voting. Publication as an International Standard requires approval by at least 75 % of the member bodies casting a vote. Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying a
33、ny or all such patent rights. ISO/IEC 9496 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments and system software interfaces, in collaboration with ITU-T. The identical text is published as ITU-T Rec. Z.200.
34、This fourth edition cancels and replaces the third edition (ISO/IEC 9496:1998), which has been technically revised. ISO/IEC 9496:2003(E) ITU-T Rec. Z.200 (1999 E) 1 INTERNATIONAL STANDARD ITU-T Rec. Z.200 (1999 E) ISO-IEC 9496 : 2002(E) ITU-T RECOMMENDATION CHILL THE ITU-T PROGRAMMING LANGUAGE This
35、Recommendation | International Standard defines the ITU-T programming language CHILL. When CHILL was first defined in 1980 “CHILL“ stood for CCITT High Level Language. The following subclauses of this clause introduce some of the motivations behind the language design and provide an overview of the
36、language features. For information concerning the variety of introductory and training material on this subject, the reader is referred to the Manuals, “Introduction to CHILL“ and “CHILL users manual“. An alternative definition of CHILL, in a strict mathematical form (based on the VDM notation), is
37、available in the Manual entitled “Formal definition of CHILL“. 1.1 General CHILL is a strongly typed, block structured language designed primarily for the implementation of large and complex embedded systems. CHILL was designed to: enhance reliability and run time efficiency by means of extensive co
38、mpile-time checking; be sufficiently flexible and powerful to encompass the required range of applications and to exploit a variety of hardware; provide facilities that encourage piecewise and modular development of large systems; cater for real-time applications by providing built-in concurrency an
39、d time supervision primitives; permit the generation of highly efficient object code; be easy to learn and use. The expressive power inherent in the language design allows engineers to select the appropriate constructs from a rich set of facilities such that the resulting implementation can match th
40、e original specification more precisely. Because CHILL is careful to distinguish between static and dynamic objects, nearly all the semantic checking can be achieved at compile time. This has obvious run time benefits. Violation of CHILL dynamic rules results in run-time exceptions which can be inte
41、rcepted by an appropriate exception handler (however, generation of such implicit checks is optional, unless a user defined handler is explicitly specified). CHILL permits programs to be written in a machine independent manner. The language itself is machine independent; however, particular compilat
42、ion systems may require the provision of specific implementation defined objects. It should be noted that programs containing such objects will not, in general, be portable. 1.2 Language survey A CHILL program consists essentially of three parts: a description of objects; a description of actions wh
43、ich are to be performed upon the objects; a description of the program structure. ISO/IEC 9496:2003(E) 2 ITU-T Rec. Z.200 (1999 E) Objects are described by data statements (declaration and definition statements), actions are described by action statements and the program structure is described by pr
44、ogram structuring statements. The manipulatable objects of CHILL are values and locations where values can be stored. The actions define the operations to be performed upon the objects and the order in which values are stored into and retrieved from locations. The program structure determines the li
45、fetime and visibility of objects. CHILL provides for extensive static checking of the use of objects in a given context. In the following subclauses, a summary of the various CHILL concepts is given. Each subclause is an introduction to a clause with the same title, describing the concept in detail.
46、 1.3 Modes and classes A location has a mode attached to it. The mode of a location defines the set of values which may reside in that location and other properties associated with it (note that not all properties of a location are determinable by its mode alone). Properties of locations are: size,
47、internal structure, read-onliness, referability, etc. Properties of values are: internal representation, ordering, applicable operations, etc. A value has a class attached to it. The class of a value determines the modes of the locations that may contain the value. CHILL provides the following categ
48、ories of modes: discrete modes: integer, character, boolean, set (enumerations) modes and ranges thereof; real modes: floating point modes and ranges thereof; powerset modes: sets of elements of some discrete mode; reference modes: bound references, free references and rows used as references to loc
49、ations; composite modes: string, array and structure modes; procedure modes: procedures considered as manipulatable data objects; instance modes: identifications for processes; synchronization modes: event and buffer modes for process synchronization and communication; input-output modes: association, access and text modes for input-output operations; timing modes: duration and absolute time modes for time supervision;