Revised Report on the Algorithmic Language Algol 68

Edited by A. van Wijngaarden, B. J. Mailloux, J. E. L. Peck, C. H. A. Koster, M. Sintzoff, C. H. Lindsey, L. G. L. T. Meertens and R. G. Fisker

This Edition, which is issued as a Supplement to ALGOL Bulletin number 47, includes all errata authorised by the ALGOL 68 Support subcommittee of IFIP WG2.l up to the end of 1978.

This Report has been accepted by Working Group 2.1, reviewed by Technical Committee 2 on Programming and approved for publication by the General Assembly of the International Federation for Information Processing. Reproduction of the Report, for any purpose, but only of the whole text, is explicitly permitted without formality.

CONTENTS

Header pages  

Acknowledgements  6 

0.  Introduction  8
 0.1.  Aims and principles of design  8
  0.1.1.  Completeness and clarity of description.  9
  0.1.2.  Orthogonal design   9
  0.1.3.  Security  9
  0.1.4.  Efficiency 9
 0.2.  Comparison with ALGOL 60  10
 0.3.  Comparison with the language defined in 1968 13
 0.4.  Changes in the method of description  15


 PART I

 Preliminary definitions

1.  Language and metalanguage  17
 1.1. The method of description  17
  1.1.1. Introduction 17
  1.1.2.  Pragmatics  18
  1.1.3.  The syntax of the strict language 19
   1.1.3.1.  Protonotions  19
   1.1.3.2.  Production rules and production trees  21
   1.1.3.3.  Metaproduction rules and simple substitution  23
   1.1.3.4.  Hyper-rules and consistent substitution  25
  1.1.4.  The semantics  26
   1.1.4.1.  Hypernotions, designation and envelopment   27
   1.1.4.2.  Paranotions  27 
   1.1.4.3.  Undefined  30
  1.1.5.  Translations and variants  30
 1.2.  General metaproduction rules  31  
 1.3.  General hyper-rules  33
2. The computer and the program  35
 2.1. Terminology  36
  2.1.1.  Objects  36
   2.1.1.1.  Values,  locales.  environs and scenes  36
   2.1.1.2.  Modes  37
   2.1.1.3.  Scopes  38 
  2.1.2.  Relationships  39 
  2.1.3.  Values  39
   2.1.3.1.  Plain values  39
   2.1.3.2. Names  41 
   2.1.3.3.  Structured values  42
   2.1.3.4.  Multiple values  42
   2.1.3.5. Routines  45 
   2.1.3.6.  Acceptability of values  45
  2.1.4.  Actions  46
   2.1.4.1.  Elaboration  46 
   2.1.4.2.  Serial and collateral actions  47
   2.1.4.3.  Initiation. completion and termination  48
  2.1.5.  Abbreviations  49 
 2.2.  The program  51


 PART 11

 Fundamental constructions

3.  Clauses 53 
 3.1.  Closed clauses 53
 3.2.  Serial clauses 54
 3.3.  Collateral and parallel clauses  57
 3.4.  Choice clauses 59
 3.5.  Loop clauses 63
4.  Declarations,  declarers and indicators  66
 4.1.  Declarations 66
 4.2.  Mode declarations  67
 4.3.  Priority declarations  68
 4.4.  Identifier declarations  68
 4.5.  Operation declarations  70
 4.6.  Declarers 71
 4.7.  Relationships between modes 74
 4.8.  Indicators and field selectors  76
5.  Units  77
 5.1.  Syntax 77
 5.2.  Units associated with names  78
  5.2.1. Assignations  78
  5.2.2.  Identity relations  79
  5.2.3.  Generators  80 
  5.2.4.  Nihils  82
 5.3. Units associated with stowed values  82
  5.3.1.  Selections  82
  5.3.2.  Slices  83
 5.4.  Units associated with routines  86
  5.4.1.  Routine texts  86
  5.4.2.  Formulas  87
  5.4.3.  Calls  88
  5.4.4.  Jumps  89
 5.5.  Units associated with values of any mode  90
  5.5.1.  Casts  90
  5.5.2.  Skips  90
 

 PART III

 Context dependence

6.  Coercion  91
 6.1.  Coercees  91 
 6.2.  Dereferencing  93
 6.3.  Deproceduring  94 
 6.4.  Uniting  94
 6.5.  Widening  95
 6.6.  Rowing  96
 6.7.  Voiding  97
7.  Modes and nests  98
 7.1.  Independence of properties  98 
 7.2.  Identification in nests  101
 7.3.  Equivalence of modes  103
 7.4.  Well-formedness  107


 PART IV

 Elaboration-independent constructions

8.  Denotations  108
 8.1.  Plain denotations  108 
  8.1.1.  Integral denotations  108
  8.1.2.  Real denotations  109
  8.1.3.  Boolean denotations 110
  8.1.4.  Character denotations  110
  8.1.5.  Void denotation  111
 8.2.  Bits denotations  111
 8.3.  String denotations 112
9.  Tokens and symbols  113
 9.1.  Tokens 113
 9.2.  Comments and pragmats  114
 9.3.  Representations 115 
 9.4.  The reference language  116
  9.4.1. Representations of symbols 118
  9.4.2.  Other TAX symbols  122

 PART V

 Environment and examples

10.  Standard environment 124
 10.1.  Program texts 124
  10.1.2.  The environment condition  125
  10.1.3.  The method of description of the standard environment   126
 10.2.  The standard prelude 128
  10.2.1.  Environment enquiries  128
  10.2.2.  Standard modes  129
  10.2.3.  Standard operators and functions  130
   10.2.3.0.  Standard priorities  130
   10.2.3.1.  Rows and associated operations   130
   10.2.3.2.  Operations on boolean operands   131
   10.2.3.3.  Operations on integral operands  131
   10.2.3.4.  Operations on real operands  132
   10.2.3.5.  Operations on arithmetic operands   133
   10.2.3.6.  Operations on character operands   133
   10.2.3.7.  Operations on complex operands   133
   10.2.3.8.  Bits and associated operations  135
   10.2.3.9.  Bytes and associated operations   136
   10.2.3.10.  Strings and associated operations   137
   10.2.3.11. Operations combined with assignations   137
   10.2.3.12. Standard mathematical constants and functions   138
  10.2.4. Synchronization operations  139
 10.3.  Transput declarations  140
  10.3.1. Books,  channels and files  140
   10.3.1.1.  Books and backfiles   140
   1O.3.1.2.  Channels  141
   10.3.1.3.  Files 143
   10.3.1.4.  Opening and closing files  147
   10.3.1.5.  Position enquiries   152
   10.3.1.6.  Layout routines  154
  10.3.2. Transput values  158
   10.3.2.1.  Conversion routines  158
   10.3.2.2.  Transput modes 163
   10.3.2.3.  Straightening  163
  10.3.3.  Formatless transput 164
  10.3.4. Format texts 172
  10.3.5.  Formatted transput  191
  10.3.6. Binary transput  205
 10.4.  The system prelude and task list  208
  10.4.1.  The system prelude   208
  10.4.2.  The system task list  208
 10.5. The particular preludes and postludes  208
  10.5.1.  The particular preludes   208
  10.5.2.  The particular postludes  209
11.  Examples
 11.1.  Complex square root 209
 11.2.  Innerproduct 210
 11.3.  Innerproduct 210
 11.4.  Largest element  210
 11.5.  Euler summation  211
 11.6.  The norm of a vector  211
 11.7.  Determinant of a matrix  212
 11.8.  Greatest common divisor  212
 11.9.  Continued fraction  213
 11.10.  Formula manipulation  213
 11.11.  Information retrieval  214
 11.12.  Cooperating sequential processes  217
 11.13.  Towers of Hanoi 217
12.  Glossaries 218
 12.1.  Technical terms  218
 12.2.  Paranotions 224
 12.3.  Predicates 227
 12.4.  Index to the standard prelude  227
 12.5.  Alphabetic listing of metaproduction rules  231