Information technology — Programming languages — Part 1: Modula-2, Base Language

Gives definition of the language Modula-2 and its standard library and specifications for symbols for Modula-2 program representation, lexical and syntactic structure and the semantics of Modula-2 programs, the interface to library modules, modules of the standard library, rules for use of the language, criteria for size and complexity of programs and requirements for implementation.

Technologies de l'information — Langages de programmation — Partie 1: Modula-2, langage de base

General Information

Status
Published
Publication Date
29-May-1996
Current Stage
9093 - International Standard confirmed
Completion Date
29-Jul-2008
Ref Project

Buy Standard

Standard
ISO/IEC 10514-1:1996 - Information technology -- Programming languages
English language
707 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)

INTERNATIONAL ISO/IEC
STANDARD 10514-I
First edition
1996-06-01
Information technology - Programming
languages -
Part 1:
Modula-2, Base Language
Technologies de I’informa tion - Langages de programmation -
Par-tie 7: Modula-2, langage de base
Reference number
&O/l EC 10514-I : 1996(E)

---------------------- Page: 1 ----------------------
ISO/IEC 10514-l : 1996(E)
Contents Page
Foreword . xiv
Introduction . xv
Section1 : Scope . 1
1.1 Goals . 1
1.2 Specifications included in this part of ISO/IEC 10514 1
...................................
1.3 Specifications not within the scope of this part of ISO/IEC 10514. . 1
Section 2 : Normative References . 3
Section 3 : Definitions, Structure, and Conventions . 4
4
3.1 Definitions .
3.2 Structure of the Formal Definition 6
..................................................
.................................................................. 8
3.3 Conventions
3.3.1 Informative text . 8
3.3.2 Typographical conventions . 8
3.3.3 References to pervasive identifiers . 9
3.3.4 Interpretation of non-VDM-SL notations . 9
3.3.5 References to formal parameter names. .
9
Section 4 : Requirements for Implementations 10
..........................................
4.1
Translation. . 10
4.2 Source Code Representation 10
......................................................
4.3
Ordering of Declarations . 11
4.4 Predefined Entities . 11
4.5 Library Modules
............................................................... 11
4.6
Errors . 12
4.7 Exceptions .
12
4.8 Implementation-dependencies
..................................................... 13
4.9 Documentation. . 13
4.10 Statement of Compliance.
........................................................ 14
4.11 Minimum requirements
.......................................................... 14
@ ISO/IEC 1996
All rights reserved. Unless otherwise specified, 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 publisher.
ISO/IEC Copyright Office l Case Postale 56 l CH-1211 Geneve 20 l Switzerland
Printed in Switzerland
ii

---------------------- Page: 2 ----------------------
ISO/IEC 10514-l: 1996(E)
@ ISO/IEC
16
Section 5 : The Lexis .
.......................................................... 16
5.1 Source Code Structure
16
5.2 Wordtokens .
16
5.2.1 Identifiers .
....................................................... 16
5.2.2 Portable Identifiers
.......................................................... 16
5.2.3 Full Identifiers
...................................................... 16
5.2.4 Pervasive Identifiers
17
5.2.5 Keywords .
.......................................................... 17
5.3 Symbols and Operators
........................................................ 17
5.3.1 Required Symbols
.................................................. 18
5.3.2 Symbols with alternatives
18
5.3.3 Operators .
20
..............................................................
5.4 Constant Literals
.................................................... 20
5.4.1 Whole Number Literals
............................................................ 20
5.4.2 Real Literals
.......................................................... 20
5.4.3 String Literals
21
...................................................................
5.5 Separators
21
............................................................
5.5.1 WhiteSpace
21
...........................................................
5.5.2 Comments.
.................................................... 21
Source Code Directives
5.5.3
21
...................................................
5.6 Letters and National Characters
23
Section 6 : The Language .
.................................... 23
6.1 Programs, Program Modules, and Separate Modules
.......................................... 23
6.1.1 Programs and Compilation Modules
........................................................ 27
6.1.2 Program Modules
....................................................... 28
6.1.3 Definition Modules
.................................................. 30
6.1.4 Implementation Modules.
.................................... 31
6.1.4.1 Sourced Implementation Modules
.................................... 33
6.1.4.2 Abstract Implementation Modules
............................... 34
6.1.5 Program Module and Separate Module Consistency
................. 34
6.1.5.1 Definition Module and Implementation Module Consistency
......................................... 36
6.1.5.2 Module Compilation Order
............................................. 37
6.1.5.3 Module Dependencies
................................................ 38
6.1.6 Module Initialization Order.
..................................................... 40
6.1.7 Program Termination
41
6.1.8 ImportLists .
..................................................... 43
6.1.8.1 Import List
.................................................. 43
6.1.8.2 Simple Imports
44
...............................................
6.1.8.3 Unqualified Import
.............................. 45
6.1.8.4 Import Consistency in Definition Modules
................................. 46
6.1.8.5 Import Consistency in Module Blocks
46
6.1.9 ExportLists .
.............................................. 46
6.1.9.1 Unqualified Exports
................................................ 47
6.1.9.2 Qualified Exports
................................................ 48
6.1.10 Implicit Import and Export
....................................................... 50
6.1.11 Protected Modules
...................................................... 52
6.2 Definitions and Declarations
.............................................................. 52
6.2.1 Identifiers
...................................................... 52
6.2.2 Qualified Identifiers
54
6.2.3 Definitions. .
......................................................... 56
6.2.4 Type Definitions
...................................................... 57
6.2.5 Procedure Headings
......................................... 58
6.2.5.1 Proper Procedure Headings
....................................... 60
6.2.5.2 Function Procedure Headings
............................................... 61
6.2.5.3 Formal Parameters
............................................................ 63
6.2.6 Declarations
. . .
111

---------------------- Page: 3 ----------------------
ISO/IEC 10514-l: 1996(E) @ ISO/IEC
66
.................................
6.2.7 Ordering of Procedure and Module Declarations
67
....................................................
6.2.8 Constant Declarations.
....................................................... 68
6.2.9 Type Declarations
69
.....................................................
6.2.10 Variable Declarations
.................................................... 71
6.2.11 Procedure Declarations
...................................... 73
6.2.11 .l Proper Procedure Declarations
76
.....................................
6.2.11.2 Function Procedure Declarations
.................................................
79
6.2.12 Local Module Declarations
..........................................
82
6.2.13 Auxiliary Formal Model Definitions.
..................................... 82
6.2.13.1 Identifiers Defined in Definitions
...................................
82
6.2.13.2 Identifiers Declared in Declarations
..................................... 83
6.2.13.3 Identifiers Defined in New Types
............................... 84
6.2.13.4 Qualified Identifiers Used in Declarations
............................... 84
6.2.13.5 Qualified Identifiers used in Expressions.
................................... 87
6.2.13.6 Qualified Identifiers Used in Types
............................... 88
6.2.13.7 Qualified Identifiers Used in Parameters
.......................... 89
6.2.13.8 Shielded Environments and Shielded Identifiers
91
6.3 DataTypes .
..................................... 91
6.3.1 Type Denoters and Ordinal Type Denoters
......................................................... 92
6.3.2 Type Identifiers
93
6.3.3 New Types .
...................................................... 94
6.3.4 Enumeration Types
95
.........................................................
6.3.5 SubrangeTypes
97
6.3.6 Set Types .
98
6.3.7 Packedset Types .
99
...........................................................
6.3.8 Pointer Types
100
........................................................
6.3.9 ProcedureTypes
........................................... 101
Proper Procedure Types
6.3.9.1
......................................... 101
Function Procedure Types.
6.3.9.2
....................................... 102
6.3.9.3 Formal Parameter Type Lists
............................................ 103
6.3.9.4 Variable Formal Types
.............................................. 104
Value Formal Types
6.3.9.5
104
6.3.10 FormalTypes .
106
6.3.11 Array Types .
107
6.3.12
RecordTypes .
.................................................... 109
6.3.12.1 Fixed Fields
................................................... 109
6.3.12.2 Variant Fields
....................................................... 114
6.3.13
Storage Allocation
114
..............................
6.3.13.1 Allocating Storage for Constructed Types
............................... 115
6.3.13.2 Allocating Storage for Elementary Types
..................... 116
6.3.13.3 Allocating Storage for Structured (Composite) Types.
............................ 120
6.3.13.4 Allocating Storage for System Storage Types
............................................ 121
Expression and Assignment Compatibility
6.4
.................................................. 121
Expression Compatibility
6.4.1
..................................................
122
Assignment Compatibility
6.4.2
6.5 Blocks.l2 6
..................................................
126
6.5.1 Proper Procedure Blocks
.................................................
129
6.5.2 Function Procedure Blocks
.......................................................... 131
6.5.3 Module Blocks
................................................ 132
6.5.4 Static Module Initialization.
................................................. 135
6.5.5 Static Module Finalization
.............................................. 136
6.5.6 Dynamic Module Initialization
............................................... 138
6.5.7 Dynamic Module Finalization
......................................... 140
6.5.8 Block Bodies and Exception Handling
................................................ 142
6.5.8.1 Non-result Bodies
................................................... 144
6.5.8.2 Result Bodies
................................................................... 146
6.6 Statements
iv

---------------------- Page: 4 ----------------------
ISO/IEC 10514-l: 1996(E)
@ ISO/IEC
147
.....................................................
6.6.1 Statement Sequences
148
.......................................................
6.6.2 Empty Statements
148
...................................................
6.6.3 Assignment Statements.
152
.........................................................
6.6.4 Procedure Calls
153
.......................................................
6.6.5 Return Statements
......................................... 154
6.6.5.1 Simple Return Statements.
......................................... 154
6.6.5.2 Function Return Statements
155
........................................................
6.6.6 Retry Statements
156
........................................................
6.6.7 With Statements
157
...........................................................
6.6.8 If Statements
........................................................ 159
6.6.9 Case Statements.
160
................................................
6.6.9.1 Case Alternatives
161
........................................................
While Statements
6.6.10
162
.......................................................
6.6.11 Repeat Statements
163
........................................................
6.6.12 Loop Statements
164
.........................................................
Exit Statements
6.6.13
164
.........................................................
6.6.14 For Statements.
168
..............................................
6.6.15 Well-formed Control Variables
169
....................................................
6.6.15.1 Threatening
176
......................................................
6.6.16 Auxiliary Functions
176
......................................
6.6.16.1 Well-formed Return Statements
....................................... 177
6.6.16.2 Well-formed Retry Statements
........................................ 177
6.6.16.3 Well-formed Exit Statements
.............................. 179
6.6.16.4 Statement Classes of Statement Sequences
182
............................................................
6.7 Variable Designators
182
.......................................................
6.7.1 Entire Designators
184
......................................................
6.7.2 Indexed Designators
185
......................................................
6.7.3 Selected Designators
187
..................................................
6.7.4 Dereferenced Designators
6.8 Expressions.18 9
190
......................................................
6.8.1 Ordinal Expressions
190
............................................
6.8.2 Infix Expressions and Operations
193
...................................
6.8.2.1 Complex Number Infix Operations
196
.......................................
6.8.2.2 Real Number Infix Operations
198
.....................................
6.8.2.3 Whole Number Infix Operations
202
..........................................
6.8.2.4 Boolean Infix Operations.
203
..............................................
6.8.2.5 Set Infix Operations
205
......................................
String Literal Infix Operations.
6.8.2.6
206
.............................................
Relational Operations
6.8.2.7
219
.......................................................
6.8.3 Prefix Expressions
220
.......................................
Arithmetic Prefix Operations
6.8.3.1
221
.........................................
Boolean Prefix Operations.
6.8.3.2
222
........................................................
6.8.4 Value Designators
223
...................................................
Entire Values
6.8.4.1
225
..................................................
Indexed Values
6.8.4.2
226
..................................................
Selected Values
6.8.4.3
227
..............................................
6.8.4.4 Dereferenced Values
229
..........................................................
Function Calls
6.8.5
230
.......................................................
Value Constructors
6.8.6
............................................... 231
6.8.6.1 Array Constructors
.............................................. 236
6.8.6.2 Record Constructors
................................................. 241
6.8.6.3 Set Constructors
........................................................ 247
6.8.7 Constant Literals
248
............................................
6.8.7.1 Whole Number Literals
.................................................... 249
6.8.7.2 Real Literals
................................................... 250
6.8.7.3 String Literals
..................................................... 253
6.8.8 Constant Expressions
V

---------------------- Page: 5 ----------------------
ISO/IE@ 10514-l: 1996(E) @ ISO/IEC
6.8.8.1 Constant Expression. Evaluation . 259
6.9 Parameter Compatibility and Argument Binding . 258
6.9.1 Actual Parameters . 258
6.9.1.1 Variable Actual Parameters . 259
6.9.1.2 Expression Actual Parameters . 260
6.9.1.3 Type Parameters . 260
6.92 Parameter Matching . 261
6.9.3 Parameter Compatibility . 261
6.9.3.1 Value Parameter Compatibility . 262
6.9.3.2 Variable Parameter Compatibility . 263
...............................
6.9.3.3 System Storage Parameter Compatibility 264
....................................................... 265
6.9.4 Argument Binding
6.9.4.1 Argument Binding to Value Parameters . 266
.............................. 267
6.9.4.2 Argument Binding to Variable Parameters
........................... 270
6.10 Predefined Types, Standard Procedures and Standard Functions
................................................ 270
6.10.1 The Pervasive Environment
........................................................ 271
6.10.2 Predefined Types
.................................... 271
6.10.2.1 Predefined Whole Number Types
....................................... 272
6.10.2.2 Predfined Real Number Types
................................... 273
6.10.2.3 Predefined Complex Number Types
............................................... 274
6.10.2.4 The Boolean Type
.............................................. 274
6.10.2.5 The Character Type
.................. 1 ....................... 276
6.10.2.6 Values of the Basic Types
........................................... 278
6.10.2.7 The String Literal Type
................................................... 279
6.10.2.8 The Nil Type
................................................. 279
6.10.2.9 TheBitset Type
.................................................. 279
6.10.2.10TheProcType
.............................................. 280
6.10.2.11The Protection Type
..................................................... 280
6.10.3 Standard Procedures
..................................... 280
6.10.3.1 Standard Procedure Designators
.............................................. 281
6.10.3.2 The Procedure DEC
.......................................... 283
6.10.3.3 The Procedure DISPOSE
............................................. 284
6.10.3.4 The Procedure EXCL
............................................. 285
6.10.3.5 The Procedure HALT
............................................... 286
6.10.3.6 The Procedure INC
............................................. 286
6.10.3.7 The Procedure INCL
............................................. 287
6.10.3.8 TheProcedureNEW
...................................................... 288
6.10.4 Standard Functions
...................................... 288
6.10.4-l Standard Function Designators
............................................... 290
6.10.4.2 The Function ABS
............................................... 291
6.10.4.3 The Function CAP
............................................... 292
6.10.4.4 The Function CHR
............................................ 292
6.10.4.5 The Function CMPLX
6.10.4.6 The Function FLOAT . 293
6.10.4.7 TheFunctionHIGH . 294
6.10.4.8 The Function IM . 295
...............................................
6.10.4.9 The Function INT. 296
...........................................
6.10.4.10The Function LENGTH 297
............................................
6.10.4.llThe Function LFLOAT 297
6.10.4.12 The Function MAX. . 298
............................................... 299
6.10.4.13The Function MIN
............................................... 300
6.10.4.14The Function ODD
............................................... 301
6.10.4.15The Function ORD
................................................ 301
6.10.4.16TheFunctionRE
............................................... 302
6.10.4.17The Function SIZE
303
............................................
6.10.4.18 The Function TRUNC
304
...............................................
6.10.4.19The Function VAL
vi

---------------------- Page: 6 ----------------------
@ ISO/IEC ISO/IEC 10514-l : 1996(E)
306
.....................................................
6.10.5 Auxiliary Definitions.
307
.....................................
6.11 The Environment and Auxiliary Formal Definitions
307
...........................................................
6.11.1 Environments
308
..................................................
6.11.1.1 Constant Values
308
.........................................................
6.11.1.2 Types
309
......................................................
6.11.1.3 Structures
311
................................................
6.11.1.4 Expression Types
...................................... 311
6.11.1.5 Types for Declared Procedures
..................................... 311
6.11.1.6 Types for Predefined Procedures
6.11.1.7 Module Environments . 312
6.11.1.8 Variables . 312
313
6.11.1.9 Protection Domains .
313
6.ll.l.lOLocal Continuations .
313
6.11.2 Operations on the Environment .
........... 313
6.11.2.1 Functions Accessing the Constants Component of the Environment
.............. 314
6.11.2.2 Functions Accessing the Types Component of the Environment
........... 315
6.11.2.3 Functions Accessing the Structures Component of the Environment
............ 315
6.11.2.4 Functions Accessing the Variables Component of the Environment
.......... 316
6.11.2.5 Functions Accessing the Procedures Component of the Environment
............ 317
6.11.2.6 Functions Accessing the Modules Component of the Environment
....... 317
6.11.2.7 Functions Accessing the Procedure Level Component of the Environment
........ 318
6.11.2.8 Functions Accessing the Continuations Component of the Environment
.......... 318
6.11.2.9 Functions Accessing the Protection Components of the Environment
................................. 319
6.11.2.10 Functions Accessing the Environment
.................................. 319
6.11.2.11 Operations to Update Environments
320
6.11.3 Types .
................................................ 320
6.11.3.1 New Type Names
...................................... 321
6.11.3.2 Structured (Composite) Types
................................................ 321
6.11.3.3 Elementary Types
6.11.3.4 Scalar Types . 322
................................................... 322
6.11.3.5 Ordinal Types
............................................. 323
6.11.3.6 Whole Number Types
.................................................. 324
6.11.3.7 Number Types
.................................................... 324
6.11.3.8 String Types
............................................. 324
6.11.3.9 System Storage Types
6.11.4 UnitTypes.32 5
.................................................... 325
6.11.4.1 Range Type
..................................................... 325
6.11.4.2 Host Type
..................................................... 325
6.11.4.3 BaseType
................................................ 325
6.11.4.4 Component Type
..................................................... 326
6.11.4.5 Index Type
.................................................... 326
6.11.4.6 Bound Type
.................................................... 326
6.11.5 Other Type Functions.
................................................... 326
6.11.5.1 Return Types
........................................... 326
6.11.5.2 Formal Parameter Types
..................................... 326
6.11.5.3 Auxiliary Functions for Records
328
6.11.5.4 Auxiliary Functions for Arrays .
.................................. 328
6.11.5.5 Auxiliary Functions for Open Arrays
328
6.11.5.6 Auxiliary Functions for Opaque Types .
328
6.11.6 Values Associated with a Type .
.................................... 331
6.12 The Storage Model and Auxiliary Formal Definitions
331
6.12.1 The Program State. .
................................................ 331
6.12.2 The External Program State
.................. 331
6.12.2.1 Operations to Initialize and Terminate the Program State
332
6.12.3 The Store. .
........................................................ 332
6.12.3.1 Storage
333
6.12.3.2 Values .
vii

---------------------- Page: 7 ----------------------
@ ISO/IEC
ISO/IEC 10514-1: 1996(E)
.................................................... 334
6.12.4 Procedure Denotations
334
..........................................................
6.12.5 Termination.
334
.............................................................
6.12.6 Exceptions
335
.......................................................
6.12.7 Interrupt Handlers
335
....................................................
6.12.8 Operations on Storage
335
.......................................
6.12.8.1 Operations Accessing Storage
336
.................................................
6.12.8.2 Storage Aliasing
.......................... 337
6.12.8.3 Operations to Allocate and Deallocate Storage.
................... 338
6.12.8.4 Operations to Allocate and Deallocate Storage Locations
.......................................... 339
6.12.8.5 Access Coroutine Storage
....................... 339
6.12.9 Accessing the Procedure Denotation Component of the State.
................................. 340
6.12.10 Program Initialization and Program Termination
340
.............................................
6.12.10.1 Program Initialization
............................................. 340
6.12.10.2 Program Termination
................................................. 341
6.12.10.3 Program Halting
...................................................... 341
6.12.11 Exception Handling
342
......................................
6.12.11.1 Allocation of Exception Sources
....................................................... 343
6.12.12 Interrupt Handlers
344
................................
6.12.13 Accessing the Protection Component of the State
344
...............................................
6.12.14 Coroutine and Continuations
........................................ 344
6.12.14.1 The &routine Environment
............................................... 344
6.12.14.2The Continuations
........................................ 345
6.12.14.3 Ope
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.