1、ANSI INCITS 74-1987 (R1998)(formerly ANSI X3.74-1987 (R1998)for Information Systems -Programming Language -PL/I General-purpose SubsetANSI X3.74-1987 Revision of ANSI X3.74-1981 American National Standard for Information Systems - Programming Language - PL/I General-Purpose Subset Secretariat Comput
2、er and Business Equipment Manufacturers Association Approved September 4,1987 American National Standards Institute, Inc Abstract This American National Standard defines the PL/I general-purpose subset programming language. The language isequally well suited for scientific, commercial, and systems p
3、rogramming applications. It provides a high degree of machine independence, thereby facilitating program exchange among a variety of computing systems. The language can be efficiently implemented on computer systems of all sizes, including minicomputer and microprocessor-based systems, This standard
4、 specifies both the form and interpretation of computer programs written in PL/I. It defines the language by specifying a conceptual PL/I machine that translates and interprets putative PL/I programs. The relationship between that conceptual machine and actual implementations of PL/I is also specifi
5、ed. This document serves as an authoritative reference rather than as a tutorial exposition. Keywords: PL/I, computer programming language, computer programming language definition, formal languages. AmericanNationalStandardApproval of an American National Standard requires review by ANSI that there
6、quirements for due process, consensus, and other criteria for approval havebeen 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 agreeme
7、nt means much more than a simplemajority, but not necessarily unanimity. Consensus 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 pr
8、eclude anyone, whether he has approved the standardsor not, from manufacturing, 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
9、 any American National Standard.Moreover, no person shall have the right or 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 o
10、n the title page of this standard.CAUTION NOTICE: This American National Standard 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 Nationa
11、l Standards may receive currentinformation on all standards by calling or writing the American National StandardsInstitute.Published byAmerican National Standards Institute11 West 42nd Street, New York, New York 10036Copyright 1987 by Information Technology Industry Council (ITI)All rights reserved.
12、No part of this publication may be reproduced in anyform, in an electronic retrieval system or otherwise,without prior written permission of ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaForeword (This Foreword is not part of AMERICAN NATIONAL STANDARD X3.74-198
13、7.) In October 1963, a committee was formed by the SHARE FORTRAN Project and the International Business Machines Corporation to extend FORTRAN, then the primary high-level language used by scientific programmers. The extended language was to be suitable for commercial and systems programs as well an
14、d was to take into account the architecture of modern computers. The committee soon determined that the language would have to differ from FORTRAN, and their report, presented in April 1964, was entitled “Specifications for the New Programming Language”. The New Programming Language was widely discu
15、ssed. Revised descriptions were issued, and in 1965 it was renamed PL/I (for programming language one). Versions were implemented on the computers of at least two manufacturers by late 1966. By April 1966, Technical Committee 10 (TC 10) had been set up by the European Computer Manufacturers Associat
16、ion (ECMA) and an ad hoc group by American National Standards Committee X3 to investigate the development of PL/I standards. TC 10 embarked immediately on standardization but the Standards Institute group first considered whether,PL/I was a suitable candidate. Early in 1969 Technical Committee X3Jl
17、was formed by American National Standards Committee X3 to carry out the work in conjunction with TC 10. The two technical committees, X3Jl and TC 10, formed the joint PL/I standardization project. Building on the work begun by TC 10, nearly 3500 proposals for language or textual change were processe
18、d in developing a joint draft standard for PL/I. The joint working document underwent thirteen complete revisions. During this time, the definition evolved from an imprecise English description to a precise specification in a semiformal metalanguage using a stylized English. The Joint Project enjoye
19、d excellent liason with potential users and with other standards organizations such as International Organization for Standardization Technical Committee 97, Subcommittee 5 (ISO/TC 97/SC 5) and PL/I working groups in Austria, France, Germany, the Netherlands, Japan, and the United Kingdom. That stan
20、dard development effort led, in August 1976, to the adoption of ANSI X3.53-1976, American National Standard Programming Language PL/I. While there were, and continue to be, several implementations of that language, the interests of parts of the user community turned toward the development of a small
21、er language - a proper subset of PL/I as described in ANSI X3.53-1976 - that would be easier to implement and use on a wide variety of machines and that would provide a higher degree of compatibility with various dialects of PL/I that had arisen in practice. A standard development process ensued, wi
22、th broad participation from within the U.S. and continued close liason with users and other standards organizations. That effort led, in July 1981, to the adoption of American National Standard PL/I General Purpose Subset, ANSI X3.74- 198 1. That document described a small subset of ANSI X3.53-1976,
23、 and its language was defined as a series of constraints and restrictions on the definitions in ANSI X3.53-1976. Technical Committee X3Jl then turned its efforts, in mid 1981, to reviews of ANSI X3.53-1976 and ANSI X3.74-198 1. At that early date, two trends in the marketplace already seemed clear:
24、1. Contrary to expectations of the Technical Committee and other participants only a few years earlier, the language described by the Subset appeared to be too restrictive for many practical uses. By early 1982, this had already begun to be reflected in common practice, as most subset implementation
25、s adopted additional features from ANSI X3.53-1976 as extensions. 2. While the implementations of ANSI X3.53-1976 have been heavily used, there are not many of them and difficult incompatibilities remained between them and older dialects of PL/I. It proved impossible to reach an adequate consensus o
26、n how to resolve these dialects at a complete language level. At the same time, there was little pressure for major extensions or modifications to the full PL/I as represented by ANSI X3.53-1976. The precision of the definition method had resulted in very few ambiguities or requests for clarificatio
27、n and, while additions were proposed, most reflected experience in existing implementations and none required incompatible change to the language as approved in 1976. X3Jl considered over 1200 proposals between 198 1 and 1986, some oriented specifically toward extending and modifying the Subset defi
28、nition, and others oriented toward PL/I language issues more generally. After a review of this body of work and the practice and directions of the PL/I community, the technical committee concluded that it should strengthen the language represented by this document to make it truly general-purpose, t
29、o reflect common practice among implementations supporting the 198 1 version of the standard, and to provide a common basis for program interchange among the variety of PL/I dialects. Since this standard contains language features that, while already present in PL/I implementations, were not present
30、 in ANSI X3.53-1976, it has been necessary, technically, to make this definition self-contained, rather than referring to that other standard. Suggestions for improvement of this standard will be welcome. They should be sent to the Computer and Business Equipment Manufacturers Association, 3 11 Firs
31、t Street, N.W., Suite 500, Washington, DC, 20001. This standard was processed and approved for submittal to ANSI by Accredited Standards Committee on Information Processing Systems X3. Committee approval of the standard does not necessarily imply that all committee members voted for its approval. At
32、 the time it approved this standard, the X3 Committee had the following members: Richard Gibson, Chair Donald C. Loughry, Vice Chair Catherine A. Kachurik, Administrative Secretary PRODUCERS Organization Represented Name of Representative Ah4P Incorporated AT the datasets may change during interpret
33、ation. However, there are no outputs defined since the datasets are treated for the purposes of this definition as being a part of the storage of the machine, i.e. as being “on-line” when needed. 1. Scope and Overviews 5 AMERICAN NATIONAL STANDARD X3.74-1987 1.4.3 Summary of Chapter Structure l.TOP-
34、LEVEL OF MACHINE-STATE AND OPERATIONS 2.CONCRETE SYNTAX j.ABSTRACT SYNTAX +.TRANSLATOR 5.INTERPRETATION-STATE + TOP-LEVEL OF INTERPRETER .FLOW OF CONTROL Concerned with the 7.STORAGE AND ASSIGNMENT 8.INPUT/OUTPUT It- three parts of the interpretation-state g.EXPRESSIONS Common Subroutines for Chapte
35、rs 5-8 Appendix A: FEATURES NEW TO THIS REVISION ADOPTED FROM X3.53-1976 Appendix B: FEATURES NEW TO THIS REVISION Appendix C: CLARIFICATIONS AND RESTRICTIONS FROM x3.74-1981 Appendix D: FEATURES OF X3.53-1976 NOT ADOPTED IN THIS STANDARD Appendix E: INCOMPATIBLE CHANGES FROM X3.74-1981 Appendix F:
36、RATIONALE FOR MAJOR DESIGN DECISIONS The operations of Chapter 1 serve to drive the Translator and Interpreter. The operations of the Translator are all contained in Chapter 4, and use the syntaxes of Chapters 2 and 3. The operations of the Interpreter comprise all the operations in Chapters 5-9. Af
37、ter the initialization in Chapter 5, the relevant operations will be in Chapters 6,7, or 8 depending on the type of statement being interpreted. All of these chapters invoke operations in Chapter 9 where necessary. All readers are recommended to acquire a good understanding of Chapter 1 in its entir
38、ety. Thereafter, it is possible to read the definition as a systematic whole, or to use the document to locate answers to specific questions by combining an appreciation of the overall structure of the definition with judicious use of the index. To illustrate this latter usage, we consider each chap
39、ter in turn together with a sample question answerable from it. Chapter 2 contains the definition of the Concrete Syntax. The Concrete Syntax consists of rules describing valid forms of PL/I constructs in concrete tree form. The syntax is permissive in the sense that some of the constructs permitted
40、 as being syntactically correct may later be found to be meaningless. 6 AMERICAN NATIONAL STANDARD X3.74-1987 QUESTION Is the following statement correct? GET LIST (A(I,J) DO I = 1 TO M,N); ANSWER The first possibility is that there may be an error according to the Concrete Syntax. The index entries
41、 for “get-statement” lead to the High-level Syntax, and study of rules CH115, CH116, CH123, CH124, and CH125 reveals that an extra pair of parentheses is required around the form *input-target-comma Chapter 3 contains the definition of the Abstract Syntax. Many parts of the Abstract Syntax descripti
42、on intentionally bear a strong resemblance to the corresponding parts of the Concrete Syntax. Names in the Abstract Syntax have been chosen to resemble those of corresponding parts of the Concrete Syntax in order to make obvious as far as possible the relationship between the syntaxes. QUESTION May
43、the KEYTO option on a READ statement specify that the key be assigned to a substring of a variable? ANSWER The Concrete Syntax for a *keyto-option+ shows merely that a kreference$ MUST be specified. However, the Abstract Syntax shows the form of a program after the Translator has completed all decla
44、rations, and has thus been able to associate each reference with the appropriate declaration and make more subtle distinctions. The rule Al23 for shows “ (scalar AND character)“. The parenthesized constraint “(scalar AND character)” shows that it MUST be a single target (not an array or structure) w
45、hich is character-valued. s are only allowed in a . Since the does not accept a , a substring may not be used. Pseudo-variables are only allowed on the left hand side of an assignment statement. Chapter 4 defines the Translator whereby each of the individual PL/I program portions (translation units)
46、 is translated from the submitted character string form to tree form and appended to the program tree. This process involves the parsing of each translation-unit using the Concrete Syntax to obtain a concrete tree, insertion of missing options and completion of attribute sets in that concrete tree,
47、conversion from that concrete tree to an abstract tree, and, finally, validation of the whole program. Once formed, the abstract tree is not modified. QUESTION What file is implied in PUT LIST(X); ? ANSWER This seems at first sight as though it might be a semantic question about the . However, the A
48、bstract Syntax shows that a is required to be present in (A130), and this means that if it was absent in the concrete form, it would have been supplied by the Translator if the statement was valid. 1. Scope and Overviews 7 AMEFUCANNATIONALSTANDARDX3.74-1987 In fact, immediately after parsing the inp
49、ut, the Translator completes the concrete procedure in various ways, one of which is to insert the equivalent of FILE (SYSPRINT) into our *put-statement+ (Step 2 of the operation COMPLETE-OPTIONS,4.5.1.1). The reason that it has to be handled early in the Translator is that it will lead to a contextual declaration of the name SYSPRINT if our statement is not within the scope of an existing declaration for SYSPRINT. It is necessary to complete all declarations prior to execution in order to resolve references correctly. Chapter 5 contains the definitions of the Machine-state Syntax, the