1、 INCITS/ISO 7185-1990 (R2003)(formerly ANSI/IS0 7185-1990(R1998) for Information Technology Programming Language PASCALANSI/IS0 7185-l 990 Revision and redesignation of ANSI/IEEE 770.X3.97-1 983 (Ri 990) American National Standard for Information Technology - Programming Language PASCAL Secretariat
2、Computer and Business Equipment Manufacturers Association Approved June 21,1993 American National Standards Institute, Inc. AmericanNationalStandardApproval of an American National Standard requires review by ANSI that therequirements for due process, consensus, and other criteria for approval haveb
3、een met by the standards developer.Consensus is established when, in the judgment of the ANSI Board of StandardsReview, substantial agreement has been reached by directly and materiallyaffected interests. Substantial agreement means much more than a simplemajority, but not necessarily unanimity. Con
4、sensus requires that all views andobjections be considered, and that a concerted effort be made toward theirresolution.The use of American National Standards is completely voluntary; their existencedoes not in any respect preclude anyone, whether he has approved the standardsor not, from manufacturi
5、ng, marketing, purchasing, or using products, processes,or procedures not conforming to the standards.The American National Standards Institute does not develop standards and will inno circumstances give an interpretation of any American National Standard.Moreover, no person shall have the right or
6、authority to issue an interpretation ofan American National Standard in the name of the American National StandardsInstitute. Requests for interpretations should be addressed to the secretariat orsponsor whose name appears on the title page of this standard.CAUTION NOTICE: This American National Sta
7、ndard may be revised orwithdrawn at any time. The procedures of the American National StandardsInstitute require that action be taken periodically to reaffirm, revise, or withdrawthis standard. Purchasers of American National Standards may receive currentinformation on all standards by calling or wr
8、iting the American National StandardsInstitute.Published byAmerican National Standards Institute11 West 42nd Street, New York, New York 10036Copyright 1990 by Information Technology Industry Council (ITI)All rights reserved.These materials are subject to copyright claims of International Standardiza
9、tion Organization (ISO),American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not forresale. No part of this publication may be reproduced in any form, including an electronic retrieval system,without the prior written permission of ITI. All requests pertai
10、ning to this standard should be submitted toITI, 1250 Eye Street NW, Washington, DC 20005.Printed in the United States of AmericaContents Page Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11、. . . . . . . . . . . . . . . . . . . . . . . . ii 1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Normative references . . . . . . . . . . . . .
12、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13、. . . . . . . 1 4 Definitional conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5 Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 5.1 Processors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 5.2 Programs . . . . . . . . . . . .
15、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16、. . . . . . . . . . . . . . . . . . . . . 5 6.1 Lexical tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6.2 Blocks, scopes, and activations . . . . . . . . . . . . . . . . .
17、 . . . . . . . . . . . . . . . . . . . . . . _ 8 6.3 Constant definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 6.4 Types - definitions . . . . . . . . . . . . . . . . . . . . . . . . . . .
18、 . . . . . . . . . . . . . . . . . . . . . . . . _ 11 6.5 Declarations and denotations of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.6 Procedure and function declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19、 . . . . . . . . . . . 24 6.7 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.8 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.9 Input and output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ._ 49 6.10 Programs . . . . . . . . . . . . .
21、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Annexes A Collected syntax . . . . . . . . . . . . . . . . . . . . . . . _. 58 B Cross - references . . . . . . . . . . . . . . . . . . . . . . . . .
22、 . _ 64 C Required identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ 71 D Errors . . . . . . . . . . . . . _ 72 E Implementation - defined features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 F Implementatio
23、n - dependent features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ 78 Foreword (This foreword is not part of American National Standard ANSI/IS0 7185- 1990. This document is identical to ISO/IEC 7185-l 990, and the following five paragraphs are the original fo
24、reword as it appeared in that document.) IS0 (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of IS0 or IEC participate in the development of Intern
25、ational Standards through technical committees established by the respective organization to deal with particular fields of technical activity. IS0 and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison
26、with IS0 and IEC, also take part in the work. In the field of information technology, IS0 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 Intern
27、ational Standard requires approval by at least 75% of the national bodies casting a vote. International Standard ISO/IEC 7185 was prepared by Joint Technical Committee ISO/IEC JTC 1, information fechnology. This second edition cancels and replaces the first edition (IS0 7185: 1983). Annexes A, B, C,
28、 D, E, and F are for information. This American National Standard reproduces verbatim ISO/IEC 7185:1990 and implements it as an American National Standard that supersedes ANSI/IEEE 770.X3.97-1983(R1990), which is withdrawn. Requests for interpretation, suggestions for improvement or addenda, or defe
29、ct reports are welcome. They should be sent to the X3 Secretariat, Computer and Business Equipment Manufacturers Association, 1250 Eye Street, NW, Suite 200, Washington, DC 20005. This standard was processed and approved for submittal to ANSI by Accredited Standards Committee on information Processi
30、ng Systems, X3. Committee approval of the standard does not necessarily imply that all committee members voted for its approval. At the time it approved this standard, the X3 Committee had the following members: James D. Converse, Chair Donald C. Loughry, Vice-Chair Joanne Flanagan, Secretary Organi
31、zation Represented Name of Representative American Nuclear Society . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Geraldine C. Main Sally Hartzell (Alt.) AMP, Inc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32、 . . . . . . . . . . . . . . . . . . _. Edward Kelly Charles Brill (Alt.) AT b) to define a language whose implementations could be both reliable and efficient on then-available computers. However, it has become apparent that Pascal has attributes that go far beyond these original goals. It is now b
33、eing increasingly used commercially in the writing of both system and application software. This International Standard is primarily a consequence of the growing commercial interest in Pascal and the need to promote the portability of Pascal programs between data processing systems. In drafting this
34、 International Standard the continued stability of Pascal has been a prime objective. However, apart from changes to clarify the specification, two major changes have been introduced. a) The syntax used to specify procedural and functional parameters has been changed to require the use of a procedur
35、e or function heading, as appropriate (see 6.6.3.1); this change was introduced to overcome a language insecurity. b) A fifth kind of parameter, the conformant-array-parameter, has been introduced (see 6.6.3.7). With this kind of parameter, the required bounds of the index-type of an actual-paramete
36、r are not fixed, but are restricted to a specified range of values. Project history In 1977, a working group was formed within the British Standards Institution (BSI) to produce a standard for the programming language Pascal. This group produced several working drafts, the tirst draft for public com
37、ment being widely published early in 1979. In 1978, BSIs proposal that Pascal be added to ISOs program of work was accepted, and the IS0 Pascal Working Group (then designated ISO/TC97/SCYWG4) was formed in 1979. The Pascal standard was to be published by BSI on behalf of ISO, and this British Standa
38、rd referenced by the International Standard. In the USA, in the fall of 1978, application was made to the IEEE Standards Board by the IEEE Computer Society to authorize project 770 (Pascal). After approval, the first meeting was held in January 1979. In December of 1978, X3J9 convened as a result of
39、 a SPARC (Standards Planning and Requirements Committee) resolution to form a US TAG (Technical Advisory Group) for the IS0 Pascal standardization effort initiated by the UK. These efforts were performed under X3 project 317. In agreement with IEEE representatives, in February of 1979, an X3 resolut
40、ion combined the X3J9 and P770 committees into a single committee called the Joint X3J9/lEEE-P770 Pascal Standards Committee. (Throughout, the term JPC refers to this committee.) The tirst meeting as JPC was held in April 1979. The resolution to form JPC clarified the dual function of the single joi
41、nt committee to produce a dpANS and a proposed IEEE Pascal standard, identical in content. ANSI/IEEE77OX3.97-1983, American National Standard Pascal Computer Programming Language, was approved by the IEEE Standards Board on September 17,1981, and by the American National Standards iv Institute on De
42、cember 16, 1982. British Standard BS6192, Specification for Computer programming language Pascal, was published in 1982, and International Standard 7185 (incorporating BS6192 by reference) was approved by IS0 on December 1,1983. Differences between the ANSI and IS0 standards are detailed in the Fore
43、word of ANSI/IEEE770X3.97-1983. In 1985, the IS0 Pascal Working Group (then designated ISO/TC97/SC22/WG2, now ISO/IEC JTCl/ SC22/WG2) was reconvened after a long break. An Interpretations Subgroup was formed, to interpret doubtful or ambiguous portions of the Pascal standards. As a result of the wor
44、k of this subgroup, and also of the work on the Extended Pascal standard being produced by WG2 and JPC, BS6192/IS07185 was revised and corrected during 1988/89; it is expected that ANSI/IEEE77OX3.97-1983 will be replaced by the revised IS0 7 185. The major revisions to BS6192: 1982 to produce the ne
45、w IS0 7 185 are: a) resolution of the differences with ANSI/IEEE77OX3.97-1983; b) relaxation of the syntax of real numbers, to allow “digit sequences” rather than “unsigned integers” for the various components; c) in the handling of “end-of-line characters” in text files; d) in the handling of run-t
46、ime errors. AMERICAN NATIONAL STANDARD ANSI/IS0 7185-1990 American National Standard for Information Technology - Programming Language PASCAL 1 Scope 1.1 This International Standard specifies the semantics and syntax of the computer programming language Pascal by specifying requirements for a proces
47、sor and for a conforming program. Two levels of compliance are defined for both processors and programs. 1.2 This International Standard does not specify a) the size or complexity of a program and its data that will exceed the capacity of any specific data processing system or the capacity of a part
48、icular processor, nor the actions to be taken when the corresponding limits are exceeded; b) the minimal requirements of a data processing system that is capable of supporting an implementation of a processor for Pascal; c) the method of activating the program-block or the set of commands used to co
49、ntrol the environment in which a Pascal program is transformed and executed; d) the mechanism by which programs written in Pascal are transformed for use by a data processing system; e) the method for reporting errors or warnings; f) the typographical representation of a program published for human reading. 2 Normative reference The following standard contains provisions which, through reference in this text, constitute provisions of this International Standard. At the time of publication, the edition indicated was valid. All standards are subject to revision, and parties to agreement