1、Information technology - Programming languages -M BS ISO/IEC 117561999 n-4 n-m U- NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGH LAW u m - STD-BSI BS ISOIIEC JlfSb-ENGL 1999 1b2Libb9 0813104 VZT D BS ISOAEC 117661999 Amd. No. National foreword Date Commens This British Standard re
2、produces verbatim ISOAEC 11756: 1999 and implements it as the UK national standard. It supersedes BS ISO/IEC 11756: 1992 which is withdrawn. The UK participation in its preparation was entrusted to Technical Committee ISTh, Programming Languages, Their Environments and System Software Interfaces, wh
3、ich has the responsibility to: - aid enquires to understand the text; - present to the responsible internationa/European committee any enquiries on the interpretation, or proposals for change, and keep the UK interests - monitor related international and European developments and promulgate iIlfOI-m
4、ed; them in the UK A list of organizations represented on this committee can be obtained on request to its secretary. Cross-references The British Standards which implement international or European publications referred to in this document may be found in the BSI Standards Catalogue under the secti
5、on entitled “International Standards Correspondence Index“, or by using the “Find“ facility of the BSI Standards Electronic Catalogue. A British Standard does not purport to include all the necessary provisions of a contract. Users of British Standards are responsible for their correct application.
6、Compliance with a British Standard does not of itself confer immunity from legal obligations. Summary of pages This document comprises a front cover, an inside front cover, the ISOIEC title page, pages ii to vii, a blank page, pages 1 to 115 and a back cover. The BSI copyright notice displayed in th
7、is document indicates when the document was last issued. This British Standard, having been prepared under the direction of the DISC Board, was published under the authority of the Standards Committee and comes into effect on 15 November 1999 O BSI 11 1999 ISBN O 680 35494 6 INTERNATIONAL STANDARD I
8、SOIIEC 11 756 Second edition 1999-06-01 Information technology - Programming languages - M Technologies de /information - Langages de programmation - M Reference number ISOIEC 1 1756: 1999(E) STD-BSI BS ISOIIEC IiL7Cb-ENGL 1779 111 Lb24bb O813LOb 2TZ m BS ISOAEC 11756:1999 Contents 1 . Scope 1 2 . N
9、ormative references 1 3 . Conformance . 2 3.1 Implementations 2 3.2 Programs 2 4 . Definitions . 4 5 . Metalanguage description . 7 6 . Routine routine . 9 6.1 Routine head routinehead . 9 6.2 Routine body routinebody 10 6.2.1 Level line levelline 1 O 6.2.2 Formal line formalline . 10 6.2.3 Label!&!
10、 10 6.2.4 Label separator . 11 6.2.5 Line body linebody 11 6.3 Routine execution 11 6.3.1 Transaction processing 12 6.3.2 Error processing 13 6.4 Embedded programs . 14 7.Expressionexe . 7.1 Expression atom gxratom . 7.1.1 Variables 7.1.2 Variable name g!yg 7.1.2.1 Local variable name 7.1.2.2 Local
11、variable handling . 7.1.2.3 Process-stack 7.1.2.4 Global variable name a, . 7.1.3.1 %CHARACTER 7.1.3.2%DEVICE . 7.1.3.3 *GLOBAL . 7.1.3.44JOB 7.1.3.5%LOCK . 7.1.3.6 *$ROUTINE 7.1.3.7 $SYSTEM . 7.1.3.8 qunspecified . 7.1.3.9 specifying default environments . 7.1.4 Expression item exoritem . 7.1.4.1 S
12、tring literal g&t 7.1.3 Structured system variable e . 15 15 15 16 16 16 19 20 21 21 23 23 24 24 24 25 25 25 26 26 7.1.4.2 Numeric literal numlit 7.1.4.3 Numeric data values . 7.1.4.4 Meaning of numlit . 7.1.4.5 Numeric interpretation of data . 7.1.4.6 Integer interpretation . 7.1.4.7 Truth-value in
13、terpretation . 7.1.4.8 Extrinsic function exfunc 7.1.4.9 Extrinsic special variable mr . 7.1.4.10 Intrinsic special variable names 7.1.4.1 1 Unary operator unarvoe 7.1.4.1 2 Name value namevalue 7.1.5 Intrinsic function function . 7.1.5.1 $ASCII 7.1.5.2 $CHAR 7.1.5.3 $DATA 7.1 54 $EXTRACT 7.1.5.5 $F
14、IND . 7.1.5.6 $FNUMBER 7.1.5.7 $GET . 7.1.5.8 $JUSTIFY . 7.1.5.9 $LENGTH . 7.1.5.10 $NAME . 7.1.5.11 $ORDER . 7.1.5.12$PIECE 7.1.5.1 3 $QLENGTH . 7.1.5.14 $QSUBSCRIm 7.1.5.15 $QUERY . 7.1.5.1 6 $RANDOM 7.1.5.17 $REVERSE . 7.1.5.18$SELECT . 7.1.5.19 $STACK 7.1.5.20 $TEXT . 7.1.5.21 $TRANSLATE . 7.1.5
15、.22 $VIEW . 7.1.5.23 $Z . 7.2 Expression tail exprtail . 7.2.1 Binary operator binarvoo . 7.2.1.1 Concatenation operator 7.2.1.2 Arithmetic binary operators 7.2.2 Truth operator truthoo . 7.2.2.1 Relational operator relation 7.2.2.2 Numeric relations . 7.2.2.3 String relations 7.2.2.4 Logical operat
16、or IoaicaloP . 7.2.3 Pattern match . . 27 27 28 28 29 29 29 30 30 34 35 35 36 37 37 37 38 38 39 40 40 40 41 42 43 44 44 45 45 45 45 47 47 48 48 48 48 49 49 49 49 50 50 50 51 8 .Commands 52 8.1 General command rules . 8.1.1 Spaces in commands 8.1.2 Comment comment . 54 8.1.3 Command argument indirect
17、ion . 8.1.4 Post conditional postcond 54 8.1.5 Command timeout timeout . 8.1.6 Line reference lineref 8.1.6.1 Entry reference entrvref 8.1.6.2 Label reference labelref 8.1 -6.3 External reference externref . 52 53 54 55 55 55 56 57 iii STD=BSI 6s ISO/IEC 1175b-ENGL 3999 W Lb24bb9 0833308 075 BS ISO/
18、IEC 11766:1999 8.1.7 Parameter passing 8.2 Command definitions 8.2.1 BREAK . 8.2.2 CLOSE . 8.2.3DO . 8.2.4ELSE . 8.2.5FOR. . 8.2.6 GOT0 8.2.7 HALT . 8.2.8 HANG 8.2.91F 8.2.10JOB . 8.2.11 KILL . 8.2.12LOCK . 8.2.13 MERGE 8.2.14NEW 8.2.17 READ . 8.2.15 OPEN . 8.2.16 QUIT 8.2.18SET . 8.2.1 9 TCOMMIT 8.
19、2.20 TRESTART . 8.2.21 TROLLBACK . 8.2.22 TSTART . 8.2.23 USE . 8.2.24 VIEW 8.2.25 WRITE 8.2.26 XECUTE . 8.2.27Z . 9 . Character Set Profile charset . 10 . Character set . 1 I . Expression elements . 11.1 Names 11.2 External routines and names 1 1.3 Local variables 11.3.1 Number of local variables .
20、 11.3.2 Number of subscripts . 11.3.3 Values of subscripts 11.4 Global variables . 11.4.1 Number of global variables 11.4.2 Number of subscripts . 11.4.3 Values of subscripts 11.4.4 Number of nodes il . 6 Number range 11.7 Integers . 11.8 Character strings 1 1.9 Special variables 11SDatatypes . 12 .
21、Expressions 12.1 Nesting of expressions . 12.2 Results 12.3 External references 57 59 59 59 60 61 61 63 63 63 64 64 65 66 67 68 69 70 71 73 75 76 76 76 77 78 78 79 80 80 81 81 81 81 81 81 81 82 82 82 82 82 82 82 83 03 83 83 83 83 83 84 iv STD-BSI BS ISO/IEC 117Sb-ENGL 1999 1b24bb7 0813109 TO1 BS ISO
22、AEC 11756:1999 13 Routines and command lines 84 13.1 Command lines . 84 13.2 Numberof command lines 84 13.3 Number of commands . 84 13.4 Labels 84 13.5 Number of labels 84 13.6 Number of routines 84 14 External routine calls . 85 15 Character Set Profiles 85 16 Indirection 85 . 17 Storage space rest
23、rictions . 18 Process-stack . 19 Formats 19.1 mnemonicsDace 19.2 controlmnemonic 19.3 Parameters 20 Transaction processing . 20.1 Number of modifications in a TRANSACTION 20.2 Number of nested TSTARTs within a TRANSACTION 85 86 86 86 86 87 87 87 87 21 Other portability requirements 87 22 The binding
24、 . 88 22.1 Controi-functions with an effect on $X or $Y or both . 88 22.2 Control-functions with an effect on $KEY . 89 22.3 Control-functions with an effect on $DEVICE . 89 22.4 Open-ended definitions . 90 23 Portability issues . 91 23.1 Implementation . 91 23.2 Application . 91 24 Conformance . 92
25、 AnnexA 93 Annex B 96 Annex C 97 Annex D 99 Annex E 101 Annex F 103 Annex G 105 Annex H 106 Index 109 . V BS ISO/IEC 11766:1999 Foreword IS0 (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standard
26、ization. National bodies that are members of IS0 or IEC participate in the development of Intemational 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 mut
27、ual interest. Other international organizations, governmental and non-govemmental, in liaison 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, ISOIIEC JTC 1. Draft Intemational Standards adopted by the joi
28、nt technical committee are circulated to national bodies for voting. Publication as an Intemational Standard requires approval by at least 75% of the national bodies casting a vote. Intemational Standard ISO/IEC 1 1756 was prepared by Joint Technical Committee ISOIIEC JTC 1, Infomation technology, S
29、ubcommittee 22, Programming languages, their environments and system soware interfaces. This second edition cancels and replaces the first edition (ISOIIEC 11756:1992), which has been technically revised. Annex A forms an integral part of this International Standard. Annexes B to H are for informati
30、on only. vi - STD*BSI BS ISO/IEC 1175b-ENGL 1777 M lb24bb7 OBL32LL bbT BS ISO/IEC 11756:1999 Introduction Section 1 consists of nine clauses that describe the MUMPS language. Clause 1 describes the metalanguage used in the remainder of Section 1 for the static syntax. The remaining clauses describe
31、the static syntax and overall semantics of the language. The distinction between “static“ and “dynamic“ syntax is as follows. The static syntax describes the sequence of characters in a routine as it appears on a tape in routine interchange or on a listing. The dynamic syntax describes the sequence
32、of characters that would be encountered by an interpreter during execution of the routine. (There is no requirement that MUMPS actually be interpreted). The dynamic syntax takes into account transfers of control and values produced by indirection. Clauses 10 through 21 highlight, for the benefit of
33、implementors and application programmers, aspects of the language that must be accorded special attention if M program transferability (.e., portability of source code between various M implementa- tions) is to be achieved. It provides a specification of limits that must be observed by both implemen
34、tors and programmers if portability is not to be ruled out. To this end, irnplementors must meet or exceed these limits, treating them as a minimum requirement. Any implementor who provides definitions in currently undefined areas must take into account that this action risks jeopardizing the upward
35、 compatibility of the implementation, upon subsequent revision of the M Language Specification. Application programmers striving to develop portable programs must take into account the danger of employing “unilateral extensions“ to the language made available by the implementor. The following defini
36、tions apply to the use of the terms explici limit and implicit limit within this document. An explicit limit is one which applies directly to a referenced language construct, Implicit limits on language constructs are second-order effects resulting from explicit limits on other language constructs.
37、For example, the explicit command line length restriction places an implicit limit on the length of any construct which must be expressed entirely within a single command line. Clauses 22 through 24 describe the binding between M and ANSI X3.64. ANSI X3.64 is a functional standard for additional con
38、trol functions for data interchange with two- dimensional character-imaging input andlor output devices. It is an ANSI standard, but also an IS0 standard with roughly similar characteristics exists (IS0 2022). As such, it has been implemented in many devices worldwide. It is expected that M can be e
39、asily adapted to these implementations. The standard defined as ANSI X3.64 defines a format for device-control. No physical device is required to be able to perform all possible control-functions. In reality, as some functions rely on certain physical properties of specific devices, no device will b
40、e able to perform all functions. The standard, however, does not specify which functions a device should be able to do, but if it is able to perform a function, how the control-information for this function is to be specified. This binding is to the functional definitions included in X3.64. The actu
41、al dialogue between the M implementation and the device is left to the implementor. Information technology- Programming languages - M 1. Scope This International Standard describes the M programming language. 2. Normative references The following standards contain provisions which, through reference
42、 in this text, constitute provisions of this International Standard. At the time of publication, the editions indicated were valid. All standards are subject to revision, and parties to agreements based on this International Standard are encouraged to investigate the possibility of applying the most
43、 recent editions of the standards indicated below. Members of IEC and IS0 maintain registers of the currently valid Intemational Standards. ISOIIEC 90751 992, Infomation technology - Database languages - SQL ANSI X3.4-1990, (ASCII Character Set) ANSI X3.64-1979, Ri990 (ANSI Terminal Device Control M
44、nemonics) 1 STDmBSI ES ISO/IEC LL75b-ENGL 1777 PI Lb24bb7 0813113 432 BS ISO/IEC 11756:1999 3. Conformance 3.1 implementations A conforming implementation shall a) correctly execute all programs conforming to both the Intemational Standard and the implementation defined features of the implementatio
45、n b) reject all code that contains errors, where such error detection is required by the International Standard c) be accompanied by a document which provides a definition of all implementation-defined features and a conformance statement of the form: “xxx version v conforms to X1 i .l-yyyy with the
46、 following exceptions: Supported Character Set Profiles are . Uniqueness of the values of $SYSTEM is guaranteed by .I . where the exceptions are those components of the implementation which violate this Intemational Standard or for which minimum values are given that are less than those defined in S
47、eCUon.2. An MDC. conforming implementation shall be a conforming implementation except that the conforming document shall be this International Standard together with any such current MDC documents that the vendor chooses to implement. The conformance statement shall be of the form: “xxx version v c
48、onforms to Xi l.l-yyyy, as modified by the following MDC documents: d (MDC status rn) with the following exceptions: . Supported Character Set Profiles are . Uniqueness of the values of $SYSTEM is guaranteed by .“ An MDC strictly conforming hplemenfafion is an MDC conforming implementation whose MDC
49、 modification documents only have MDC Type A status and which has no exceptions. A . implementation is an implementation conforming to one of the above aptions in which the requirements of Section 2 are replaced by the are implemented. An implementation may claim more than one level of conformance if it provides a switch by which the user is able to select the conformance level. 3.2 Programs A strictly conforming program shall use only the constructs specified in Section 1 of this Intemational Standard, shall not exceed the limits and restrictions spec