ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf

上传人:孙刚 文档编号:798009 上传时间:2019-02-02 格式:PDF 页数:89 大小:3.72MB
下载 相关 举报
ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf_第1页
第1页 / 共89页
ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf_第2页
第2页 / 共89页
ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf_第3页
第3页 / 共89页
ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf_第4页
第4页 / 共89页
ITU-T HDBK IC-1993 Introduction to Chill (Study Group X 89 pp)《冷的介绍 研究组 89pp》.pdf_第5页
第5页 / 共89页
点击查看更多>>
资源描述

1、 STD-ITU-T HDBK IC-ENGL 1993 111 4B6259L 0682443 446 Ip INTERNATIONAL TELECOMMUNICATION UNION ITU-T TELECOMMUNICATION STANDARDIZATION SECTOR OF ITU INTRODUCTION TO CHILL STDmITU-T HDBK IC-ENGL 1993 9 486259L Ob82444 382 INTERNATIONAL TELECOMMUNICATION UNION ITU-T TELECOMMUNICATION STANDARDIZATION SE

2、CTOR OF TU INTRODUCTION TO CHILL ISBN 92-61 -04891 -9 STD-ITU-T HDBK IC-ENGL 1993 4862593 0682445 219 NOTES 1 As a consequence of a reform process within the International Telecommunication Union (ITU), the CCITT ceased to exist as of 28 February 1993. In its place, the IT Telecommunication Standard

3、ization Sector (ITU-T) was created as of 1 March 1993. Similarly, in this reform process, the CCIR and the IFRB have been replaced by the Radiocommunication Sector. In order not to delay publication of this Introduction, no change has been made in the text to references containing the acronyms “CCIT

4、T, CCIR or IFRB” or their associated entities such as Plenary Assembly, Secretariat, etc. Future editions of this Recommendation will contain the proper terminology related to the new ITU structure. 2 previous 1980 version. This 1993 version of the “Introduction to CHILL” was prepared by IT-T Study

5、Group X, and replaces the O ITU 1993 All rights reserved. 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 the ITU. Contents 1 introduction 2 Lexical Conventions 3

6、 Data 3.1 Mode Definitions . 3.2 Synonym Definitions 3.3 Location Declarations 3.4 Discrete Data . 3.5 Res . 3.6 Powersets 3.7 References 3.8 Procedures 3.9 Strings 3.10 Arrays 3.11 Structures 3.12 Mode Checking . 3.13 Mode Conversions 3.14 Conditional Expressions . 3.15 Operator Precedence . . 4 Ac

7、tions 4.1 Assignment Action 4.2 IfAction . 4.3 CaseAction . 4.4 DoAction 4.5 ExitAction 4.6 GotoAction . 4.7 CaLlAction 4.8 Assert Action 5 Program Structure 5.1 Blocks 5.2 Procedures 5.3 Modulions 5.4 Piecewise Programming . lTU-T . Introduction to CHILL 1 3 4 4 5 6 7 11 Il 12 14 15 17 18 20 21 22

8、23 25 25 26 27 28 32 33 33 34 35 35 36 40 42 i STD-ITU-T HDBK IC-ENGL 2773 4862571 Ob82447 O71 5.5 NameManagement . 45 6 Concurrent Execution 47 6.1 Processes . 47 6.2 Synchronisation . 48 6.3 Communication . 52 7 Time Supervision 56 7.1 Timeoutable Processes 56 7.2 TimingData . 56 7.3 TimingActions

9、 . 57 8 Exception Handling 61 9 Input and Output 64 9.1 FiieHandiing 65 9.2 DataTransfer . 66 9.3 Text Inputloutput 67 References 78 Index 79 11 ITU-T . introduction to CHILL STD-ITU-T HDBK IC-ENGL 1793 48b257L 0682448 T28 Chapter 1 Introduction CHILL is the high-level programming language defined a

10、nd recommended by the International Telegraph and Telephone Consultative Committee (CCITT) for the production of software for telecommunication systems. In 1988, the Intemational Standardization Organization (ISO) and the International Electrotechnical Commission (IEC) adopted CHILL as the internati

11、onal standard ISO/IEC 9496. CHILL was initially designed for the development of stored program control switching systems. However, it has proven to be a general and powerful high-level programming language, being used in many other applications (e.g. suport software), mainly in the fields of private

12、 and public telecommunications. The CCITI”s Recommendation Z.2001, 21 is the definitive reference of the language, providing a complete definition of its features. Although the 2.200 can answer any question concerning the syntax and semantics of the language, being the natural guide for compiler wri

13、ters, its formal and concise style of presentation is inadequate for programmers. The purpose of this document is to provide an overview of the main features of CHILL, by concentrating on their semantics and use, rather than on their syntax and subtle exceptional cases. The reader is not required to

14、 be famiiiar with CHILL, but is supposed to know at least another high-level programming language, such as Pascal3 or C4. The CHILL syntax is not very different from the syntax of those languages and might not be difficult to understand, even without a formal description. The presentation of the lan

15、guage is intended to be self-contained. In case of doubt the reader should consult 2.200. CHILL belongs to a programming language generation which emerged after PU1 5, Algol 686 and Pascal. It Since then, the maintenance and the evolution of this recommendation has been in charge of a CCITT team. Th

16、e team evaluates the feedback supplied by language users and implementors and the decisions made at the previous periods. This has been extremely positive for the language by allowing the continuous improvement of the accuracy of its definition, its readability, and its expressiveness. I was develop

17、ed in parallel with Ada7 in the 70s. The first version of the 2.200 was published by CCIT in 1980. At present, CHILL is one of the most refined high-level programming languages. It implements many of the recent ideas raised in the software engineering field and offers constructs and mechanisms orien

18、ted toward concurrent programming in centralised and distributed systems. Some of these features are outlined below. CHILL stands for QXT - This example defines a synonym for a subrange of integers from 1 to 3 1. Day is called the synrnode name and range (1:3i) the defining mode of the mode definiti

19、on. Day can be used with the same meaning of the defining mode, in any context. In particular, day locations can be assigned to range (i:31) locations and vice-versa. There are two kinds of mode definitions. The one introduced by the reserved word synmode defines synonyms for a given mode. The reser

20、ved word newmode, on the other hand, introduces mode definitions where new modes are defined. This means that the names in a newmode definition are not synonyms, but names of modes that, although sharing the same structure with the defining mode, are incompatible with it. 4 ITU-T - Introduction to C

21、HILL STD-ITU-T HDBK IC-ENGL 1993 48b2591 Ob82452 459 newmode dollar, pound = int; This defines two new modes: dollar and pound. Both of them share the same structure with the defining mode int, inheriting most of the properties of integers. In particular, dollar and pound can be used to index an arr

22、ay, and their values can be arithmetically operated. They cannot be intermingled, however. It is not allowed to assign a pound value to a dollar location, neither to sum a dollar with a pound. Newmode definitions are very useful since they allow the compiler to detect some errors during mode checkin

23、g that a mere structural mode compatibility mechanism would not. Every mode defines the size of the locations associated to it. The built-in routine size applied to a mode delivers the size of its locations in addressable units . 3.2 Synonym Definitions Synonyms (constants) are named values. The nam

24、e defined in a synonym definition can be used in any context in place of the constant value that it represents. The use of synonyms greatly improves program readability and maintainabiiity. syn zero = O, pi = 3.1415; tilde = - , In this example, zero is a synonym denoting the integer value O. Tilde

25、denotes the character value *-, and pi denotes the real value 3.1415. Unlike Pascal-in which only discrete and real values can be named in a constant definition-CHILL allows any value to be named in a synonym definition. syn message = “This is a message. I, OCMS = OCMA* defaultstat = status .fileid:

26、 O, Message is a synonym for a string value, ocrs for an array value, and defaultstat for a structure value. Array and structure values are described by tuples (see sections 3.10 and 3.1 1). It is possible to associate a mode with a synonym. An addressable unit is the smallest chunk of memory a comp

27、uter can address. It is usually a byte, but there are architectures where the addressable units are 16- or 32-bit words. This means that the result of size is implementation dependent. -T - Introduction to CHILL 5 STD-ITU-T HDBK IC-ENGL 1993 1511 4b2591 0682453 395 sl sYn million = f OOOO, milfiondo

28、llars dollar = 1 _OOOOOO; Million is an integer value that can be stored in locations of any mode derived from int. In particular, it can be stored in a dollar location. On the other hand, milliondollars is a dollar value. It can only be stored in aocations with a dollar mode. 3.3 Location Declarati

29、ons A location is a place for storage of values. A location can be accessed for different purposes, such as reading a value, storing a value, or to obtain its address. A location declaration is introduced by the reserved word dcl, followed by a list of names and a description of a mode. Optionally,

30、the locations can be initialised with a value in its declaration. dcl i int, j, k int := O; In this example, i, j, and k are integer locations. Both j and k are initialised with O. The initial value of i is undefined. This simple kind of location declaration creates new locations. A loc-identity dec

31、laration is different in that it creates new accesses to locations declared elsewhere. dcl table array (f:f) int, element int loc := rable(25 -t i); In the example above the loc-identity location element is a new access name for the array element denoted by table(2-5 -+ i). Note that i can be any in

32、teger location. In particular, it can be a procedure parameter. This means that element can access different elements of table in different procedure activations. A mode can have the read-only property, meaning that all locations assigned to it must be initialised in their declarations, but not modi

33、fied later on. Such modes are commonly used in loc-identity declarations. In fact, one can create a read-only access to a read-write location by declaring a read-only loc-identity refemng to it. dcl i int, ir read int loc := i; In this example, the contents of i can be read but not modified through

34、the loc-identity ir. If i is declared inside a module, its contents can be made accessible outside the module boundaries by granting the loc-identity ir. This way, the module implementor is protected against modifications made by others to its private data. 6 U-T - Introduction to CHILL STDmITU-T HD

35、BK IC-ENGL 1993 4862593 Ob82454 223 M CHILL does not impose any restriction on the order in which the data in a program are defined or declared. in particular, a mode name can be used in a location declaration before its definition. This flexibility can be used to make the program clearer by groupin

36、g related mode definitions and ordering them from the most complex to the most simple. As an example, the following Pascal program extract defines a data structure to describe a list of persons. const N = 100; tY Pe agemode = O 130; person = record name: packed array O 791 of char; nameength: O 80;

37、age: agemode; person-list = array O IV of person; end; var group: person-list; The largest data of this passage is the variable group, since it is the list. However, one have to skim all other definitions until find it. A clear bottom-up approach. The same data structure, defined in CHILL, could tak

38、e advantage of its greater flexibiiity to emphasise what is largest in a more hierarchical order. dcl group personlist; newmode personist = array (0:N) person; newmode person = struct (name chars (80) varying, age age-mode); synmode agemode = range (0:130); This way, the reader is presented first to

39、 the big picture. The details can be found later, if needed. 3.4 Discrete Data Discrete data are values and locations associated with discrete modes. Discrete modes define finite sets of weli ordered values. Each discrete value has an internal representation denoted by an integer value. The order of

40、 the 7 ITU-T - introduction to CHILL STD*ITU-T HDBK IC-ENGL 3993 W 4862593 0682455 Lb8 W values is based on the order of their internal representations. CHILL has a set of predefined discrete modes: integers, booleans, characters, sets, and ranges thereof. Discrete data can be operated upon in many

41、ways to construct expressions. In particular, any pair of discrete data of the same mode can be compared by means of relational operators (=, /= , , =, .val /= O; od; p := p- .next; This loop implements the basic algorithm of a hear search through a linked list. The expression controlling the loop c

42、hecks if p has not reached the end of the list (p /= null) and if the element pointed to by p is not the target of the search - .val /= O). Note that, ifp is null it cannot be dereferenced (p- .val). The andif operator evaluates first its left operand. Only if it is true the second operand is evalua

43、ted. If we had used the operator and instead, we couldnt be sure either of the order of evaluation or if all operands would, indeed, be evaluated. Characters The character mode defines a sequence of 256 character values. Actually, the character set of CHILL is an extension of the CCIT Alphabet No.5,

44、 International Reference Version, Recommendation V3. The first 128 values are the same as defined by the ASCII standard. The name char is predefined as the character mode name. For ail printable characters but the circumflex (*), the corresponding character literal can be simply the printable repres

45、entation of it enclosed in apostrophes. For example, a, O, (space), and ” (a single apostrophe). A control sequence is a way of representing any character, even the non-printable ones, so that it is possible to construct character literals for any character value. In its most general form, it consis

46、ts of a circumflex followed by a constant integer expression in parenthesis, denoting the internai representation of the character. (That is why the circumflex is not allowed to appear in a simple printable representation.) Enclosing a control sequence in apostrophes we can construct character liter

47、als for any character. *(O) - the character NUL * (255) *(32) - - the character which code is 255 - the same as (space) A circumflex followed by a printable character is a control sequence denoting the character value obtained by negating the 7* bit of its internal representation. It is commonly use

48、d as a more readable notation for the special characters in the range O: 3 1. * *A * M - the same as -(O) - the same as *() - the same as * (1 3) , which is the CR character - the same as * (127)” which is the DEL charactex r 3 Finaliy, there is a special way to denote the circumflex itself. - - whi

49、ch is the same as * (94) . ,A*, -T - Introduction to CHILL 9 STD-ITU-T HDBK IC-ENGL 1993 48b2591 Ob82457 T30 Sets A set mode (enumeration type) defines a set of values that can be used to represent non-numeric (symbolic) quantities. A set mode is described by the reserved word set followed by a list of value names enclosed in parenthesis. newmode colour = set (red, green, blue, yellow); Colour defines four named values. The internal representation of red is O, green is 1, blue is 2, and

展开阅读全文
相关资源
猜你喜欢
相关搜索

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

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