HTML entities are used for the following characters: Σ for Sigma, ² for squared, ½ for half, α for alpha, β for beta, π for pi, θ for theta, ≠ for noteq, ≤ for leq, ≥ for geq, ≡ for equiv, ↑ for powers, ± for plus/minus, ø for slashed o.

A handful of overprinted characters need to use Unicode combining characters. These are used to represent character literals in Autocode (see 5.3 and 5.6 for examples.) However, most browsers on most OSes don't display these correctly, so we use ~~strikeouts~~ instead. The characters are s, n and semicolon, and should in reality have either a slash or vertical bar through them as follows: "s̸", "n̸", ";̸", "s⃒", "n⃒", ";⃒".

PREFACE This manual is a reference manual which describes the Atlas Autocode Compiler currently available (1/3/65) at Manchester University. It is not a teaching manual though we have tried to make it fairly readable. Further compilers may in the future become available both on Atlas and other machines and it is expected that they will be described with reference to this manual. We would like to thank Mr. G. Riding for his many valuable comments and suggestions and Miss Christina O'Brien who has typed and re-typed the manuscript. R.A. Brooker J.S. Rohl. 1st March 1965

CONTENTS1.INTRODUCTIONExample of an Atlas Autocode Program 1.1 Blocks and Routines 1.2 Phrase Structure Notation 1.2 2.THE BASIC LANGUAGESymbols of the Language 2.1 Names 2.1 Constants 2.2 Delimiters 2.2 Types 2.3 Declaration of Variables 2.3 Functional Dependence 2.5 Standard Functions 2.5 Arithmetic Expressions 2.5 Integer Expressions 2.6 Arithmetic Assignments 2.7 Simple Labels 2.8 Vector Labels 2.8 Conditional Labels 2.9 Conditional Operators 2.9 Cycle Instructions 2.10 Miscellaneous Notes 2.11 3.STORAGE ALLOCATION AND BLOCK STRUCTURE OF PROGRAMSThe Stack 3.1 Storage Allocation Declarations 3.1 Block Structure of Programs 3.2 4.ROUTINESBasic Concepts 4.1 Formal Parameters and Actual parameters 4.3 Function Routines 4.5 Scope of names 4.6 Permanent Routines 4.6 Functions and Routines as Parameters 4.7 Recursive Use of Routines 4.8 Own Variables 4.9

5.INPUT AND OUTPUT OF DATASelection of Data Channels 5.1 Basic Input Routines 5.1 Basic Output Routines 5.4 Captions 5.6 Binary Input and Output 5.6 6.MONITOR PRINTING AND FAULT DIAGNOSISCompiler Time Monitoring 6.1 Run Time Monitoring 6.2 Fault Trapping 6.5 Fault Diagnosis 6.5 Query Printing 6.6 Routine Tracing 6.7 Jump Tracing 6.7 Array Bound Check 6.7 Other Checking Facilities 6.7 7.PRESENTATION OF COMPLETE PROGRAMSProgram and Data on Same Tape 7.1 Program and Data Tapes Separate 7.3 Program on Several Tapes 7.4 8.COMPLEX ARITHMETICDeclarations 8.1 Standard Functions 8.1 Arithmetic Expressions 8.2 Arithmetic Instructions 8.2 Conditions 8.4 Routines and Functions 8.4 Input and output of Complex Numbers 8.5 9.STORE MAPPINGThe Address Recovery Function 9.1 Array Functions 9.1 The Renaming of Variables within a Block 9.3 Store Mapping Routines 9.4

10.THE USE OF MACHINE INSTRUCTIONSStack Structure 10.1 Stack Instructions 10.4 Machine Code Formats 10.5 Example of Use of Machine Orders 10.7 11.THE PERMANENT ROUTINESLinear Equations 11.1 Matrix Routines 11.2 Solution of Differential Equations 11.3 APPENDIX 1 PHRASE STRUCTURE NOTATION APPENDIX 2 INDEX OF STANDARD FUNCTIONS AND PERMANENT ROUTINES APPENDIX 3 INDEX OF DELIMITERS APPENDIX 4 LIST OF MONITORED FAULTS APPENDIX 5 NUMERICAL EQUIVALENTS OF BASIC AND COMPOSITE SYMBOLS

1.2beginreala, b, c, Sx, Sy, Sxx, Sxy, Syy, nextx, nextyintegern read (nextx) 2: Sx = 0; Sy = 0; Sxx = 0; Sxy = 0; Syy = 0 n = 0 1: read (nexty) ; n = n + 1 Sx = Sx + nextx; Sy = Sy + nexty Sxx = Sxx + nextx² ; Syy = Syy + nexty² Sxy = Sxy + nextx*nexty 3: read (nextx) ; ->1unlessnextx = 999 999 a = (n*Sxy - Sx*Sy)/(n*Sxx - Sx²) b = (Sy - a*Sx)/n c = Syy - 2(a*Sxy + b*Sy) + a²*Sxx - 2a*b*Sx + n*b² newline print fl(a,3) ; space ; print fl(b,3) ; space ; print fl(c,3) read (nextx) ; ->2unlessnextx = 999 999stopend of programBLOCKS AND ROUTINESComplete programs are generally split up into a number of self-contained units called ROUTINES, and each routine may be further split into a number of BLOCKS. A detailed description of their construction and use is deferred until later, but in the earlier sections it is sufficient to note that the Autocode statements betweenbeginandendconstitute a block. However when a block defines a complete program as in the above example,endis replaced byend of program.PHRASE STRUCTURE NOTATIONAtlas Autocode is a PHRASE STRUCTURE LANGUAGE and to assist in its description we sometimes have resort to phrase structure notation. In general, whenever a name appears in square brackets in the description of an Autocode statement, we mean that in an actual statement it would be replaced by a particular element of the class defined by the name. For example, in the next section we define [NAME] and [EXPR] to denote a general name and a general expression respectively, and with these definitions we could go on to define a function of a single variable by [NAME] ([EXPR]) and in an actual program this might be replaced by g(x + y - 2) since g is a name, and x + y - 2 is an expression. Further notes on phrase structure notation will be found in Appendix 1.

2.2 Underlined names and mixed names such as RK2ST are NOT allowed. There are certain names, e.g. log, sin, exp, print, read, etc. which have a standard meaning (the PERMANENT routines) but all other names must be declared before any reference is made to them (see below). In future a general name will be denoted by [NAME].CONSTANTSNumerical (positive) constants are written in a straight forward notation. For example:- 2.538 1 .25 17.28α-1 1α7 The last two examples mean 1.728 and 10000000. The numerical part can be written in any number of ways. For example: - 15 015 15. 15.000 are all equivalent. The exponent, where present, consists of α followed by an optional sign and decimal digits. The symbol ½ is equivalent to the two symbols .5. Thus 2.5 may be punched as 2½. There is a further specialised type of constant consisting of a symbol (either basic or composite) enclosed in quotes. Its value is that of the internal equivalent of the symbol, a list of which is given in Appendix 5. Thus 'a' ≡ 33 'ø' ≡ 2063 Though this form of constant may be used whenever a constant is relevant it is most often used when reading symbols off a data tape (see Section 5).DELIMITERSThese are a preassigned set of symbols and underlined words. For example:- + - * / ( , ) > ≥ -> ; πcyclerepeatintegerrealifthencaptioncommentNote that -> consists of two symbols, -followed by> Unlike names whose meaning can be defined by the user, delimiters have fixed absolute meanings in the language.

2.3TYPESCalculations are performed on two principal types of operand,realandinteger(later on we shall introducecomplex). Both are represented by floating point numbers (in the form a*8↑b where a is held to a precision of 40 binary digits and b is an 8-bit integer); but those ofintegertype are kept in an unstandardised form (so that the least significant 24 bits can be used directly for B-modification; the precise method of storage is described in the section on machine instructions). The locations in the computer store holding numbers are distinguished by assigning names to them (see later), and reference to the number is made by giving the appropriate name. Both real and integer numbers referred to in this way are called variables and denoted by [VARIABLE]. Programs will consist mainly of operations onrealoperands, the use ofintegeroperands being generally confined to counting and subscript arithmetic.DECLARATION OF VARIABLESThe names of variables used in a block are declared at the head of the block; For example:-integerI, max, minrealt, Temp, VOL 1, VOL 2 The effect of these declarations is to allocate storage positions (ADDRESSES) to the named variables, and any subsequent reference to one of the declared names will then be taken as referring to the number stored in the appropriate address. The format of these declarations is formally [TYPE][NAME LIST] where [TYPE] =integer,real[NAME LIST] = [NAME][REST OF NAME LIST] [REST OF NAME LIST] = [,][NAME][REST OF NAME LIST],NIL N.B. This means of defining a list consisting of phrases separated by commas is used throughout: See Appendix 1.

2.4 One dimensional arrays of elements may be declared by statements such asarraya,b(0:99), c(10:19) which reserves space for three arrays ofrealvariables a(i), b(i), c(i). In the first two the subscript runs from 0 to 99, and in the third from 10 to 19. To refer to a particular element of an array one might write a(50) b(j) b(2n+2j-1) c(10+i) It is the computed value of the argument, which may be a generalintegerexpression (see later), which determines the particular element. Two dimensional arrays are declared in a similar way. For example:-arrayA(1:20,1:20), B(0:9,0:49) This defines and allocates storage for a 20 X 20 array A and a 10 X 50 array B. To refer to a particular element, one writes, tor example:- A(1,1) A(i-1,j+1) B(9,2K+1) Should an array ofintegerelements be required, the declaration is qualified by integer. For example:-integer arrayKa (1:50). Arrays of more than 2 dimensions may also be declared. For example:-arrayCUBE 1, CUBE 2 (1:10,1:10,1:10) reserves 1000 locations for each of the two arrays CUBE 1, CUBE 2. Storage allocated by all the above declarations has dynamic significance, i.e. they are implemented at run time and not at compiler time. Consequently, the arguments in array declarations need not be constants but may be generalintegerexpressions. The significance of this will be explained in the sections on block structure and dynamic storage allocation (see later). The format of an array declaration is [TYPE']array[ARRAY LIST] where [TYPE'] =integer,real, NIL [ARRAY LIST] = [NAME LIST] ([BOUND PAIR LIST])[REST OF ARRAY LIST] [BOUND PAIR] = [EXPR]:[EXPR] Here the [EXPR]'S must beinteger[EXPR]'S (see P2.6)

2.5FUNCTIONAL DEPENDENCEFunctional dependence is indicated by writing the name of the function followed by the list of arguments in parentheses (in a similar fashion to array elements). For example: - sin(2πx/a) arctan(x,y) TEMP(i) a(10,10) Each argument can be an arithmetical expression (see below). Within a block all names must be distinct, and it is not possible to have a function with the same name as a scalar. Thus a and a(i) or f and f(x) would NOT be allowed to appear in the same block.STANDARD FUNCTIONSCertain standard functions are available and may be used directly in arithmetic expressions (see next section) without formal declaration: sin(x) cos(x) tan(x) log(x) exp(x) sqrt(x) arcsin(x) (-π/2 ≤ result ≤ π/2) arccos(x) (0 ≤ result ≤ π) arctan(x,y) (= arctan (y/x), -π ≤ result ≤ π) radius(x,y) (= sqrt (x²+y²) ) mod(x) (= |x|) fracpt(x) (= fractional part of x) intpt(x) (= integral part of x) int(x) (= nearest integer to x. i.e. intpt(x+.5)) parity(n) (= (-1)↑n) The last three functions are of typeinteger(see later), the rest of typereal. The arguments of all these functions may be general expressions, except that the argument of the last must be of typeinteger. A complete list of standard functions is given in Appendix 2.ARITHMETIC EXPRESSIONSA general arithmetical expression is denoted by [EXPR] and consists of an alternating sequence of operands and operators possibly preceded by a sign symbol, thus * [±'] [OPERAND][OPERATOR][OPERAND][OPERATOR] .... [OPERAND] An [OPERAND] is a [VARIABLE], [CONSTANT], ([EXPR]), |[EXPR]|, or [FUNCTION], and an [OPERATOR] is one of + - / ↑ (the asterisk denoting multiplication). **Or, more strictly, (See Appendix 1) [EXPR] = [±'][EXPR'] [EXPR'] = [OPERAND][OP][EXPR'],[OPERAND] [OPERAND] = [NAME][APP],[CONST],([EXPR]),|[EXPR]| [±'] = +,-,NIL

2.9CONDITIONAL LABELSAnother kind of multi-way switch istest4, 5, 6 illustrated by the accompanying diagram. --- Here the conditions at the places indicated --- are tested in turn and control passes to the 4casex<1:--- instruction following the first to be successful. --- If none is satisfied a fault is signalled. 5case0≤x≤1:--- The general form of the label is [N]case[COND]: --- where [COND] denotes the general 6casex>1:--- condition defined in the next section. A --- simple label [N]: may be used in place of --- the last alternative(i.e. 6:) in which case control passes directly to the following instructions if it reaches that point.NOTEAll labels are local to the block containing them and jump instructions may only refer to labels within the block (see later). CONDITIONAL OPERATORS A CONDITIONAL OPERATOR of the formif[COND]thenorunless[COND]thenmay be written before any unconditional instruction. These form the FORMAT CLASS [UI] (see Appendix 1) and include arithmetic, jump and test instructions. The [COND] phrase takes one of the forms** [SC]and[SC]and[SC] ---and[SC] or [SC]or[SC]or[SC] ---or[SC] or just [SC] Here [SC] denotes one of the following 'simple' conditions [EXPR][ø][EXPR] or [EXPR][ø][EXPR][ø][EXPR] or [(COND]) where [ø] denotes one of the comparison symbols = ≠ > ≥ < ≤ If (or unless) the condition is satisfied the instruction is obeyed, otherwise it is skipped and control passes directly to the next instruction. Examples of conditional instructions and conditional labels areifx < 0thenx = mod(y)if0 ≤ x ≤ 1and0 ≤ y ≤ 1then-> 1case(y > 1ory < - 1)andx ≥ 0: ** or, more strictly, (see Appendix 1) [COND] = [SC]and[AND-C], [SC]or[OR-C], [SC] [AND-C] = [SC]and[AND-C],[SC] [OR-C] = [SC]or[OR-C],[SC]

2.11MISCELLANEOUS NOTES1.end of programis the formal end of the program and appears after the last written instruction; its action is to terminate the reading of the program and to start obeying it from the first instruction. 2. The instructionstopcan appear anywhere in the program and signifies the dynamic end of the program; its action is to terminate the calculation. 3. The delimitercommentallows written comments to be inserted in a program to assist other users in understanding it. The information followingcomment(which may include composite characters) up to the next newline or semi-colon is ignored by the computer. The delimiterspageand | are synonyms forcomment, though the first has an obvious special use in the pagination of programs. 4. It has been noted earlier that all spaces and underlined spaces in a program are ignored and that Autocode statements are terminated by a semi- colon or a newline. If a line is terminated by the delimitercthen the following newline character is ignored by the computer. Thus a single statement may extend over several lines of the printed page. It is not anticipated that this facility will be frequently used, except when writing comments and possibly long algebraic expressions. 5. If a programmer is prepared to exclude upper case letters from names and captions, then he can effect a saving both in the size of the tape and the speed of compilation, by using the special instructionupper case delimitersand then writing all following delimiters in upper case without the underlining. Thus the example of P2.10 could then be written:- CYCLE i = 1,1,p CYCLE k = 1,1,r c(i,k) = 0 REPEAT CYCLE j = 1,1,q CYCLE k = 1,1,r c(i,k) = c(i,k) + a(i,j)*b(j,k) REPEAT REPEAT REPEAT The delimiter causes the compiler to replace each upper case letter by the equivalent underlined lower case letter, so that a mixture of normal and upper case delimiters can be used. If this is required only for certain parts of a program then the instructionnormal delimiterscan be used to return the compiler to its normal operation.

4.4 In the example of a routine to evaluate a polynomial described earlier, the formal parameter y is the name of the variable to which the result is assigned, and the corresponding actual parameter must be a name, in this case the name of arealvariable. The formal parameter then is of typereal name. A reference to y inside the routine is essentially a reference to the non-local variable named by the actual parameter. The same applies to thearray nameparameter a, a reference to a inside the routine being a reference to the non-local array whose name is substituted for a in the calling statement. The formal parameterrealx on the other hand can be replaced by a general arithmetic expression, which is evaluated and assigned to the local variable x which is specially created in addition to any localrealvariables declared in the routine, The same applies to the formal parametersintegerm,n. These are essentially local quantities, and expressions are substituted in place of them are evaluated and the resultant values assigned to the localintegervariables m and n, which are lost on exit from the routine. Consequently the routine should place the information it produces in variables which are called by NAME (such as x and a). The formal parameters x, m, n are said to be called by VALUE in so far as it is only the values of the corresponding actual parameters which are of interest. This is the essential difference between the formal parameter typesarrayandarray name(orinteger arrayandinteger array name). In the former case the array named by the actual parameter is copied into a specially created local array, and a reference to the name in the routine is taken as referring to this local array. As the copying process can be time-consuming and space-consuming arrays should be called by NAME if at all possible, especially if they are large. Another example of a routine is the followingroutinematmult(arraynameA,B,Cintegerp,q,r)integeri,j,k ;realccyclei = 1,1,pcyclej = 1,1,r c = 0cyclek = 1,1,q c = c+A(i,k)*B(k,j)repeatC(i,j) = crepeatrepeatendThis forms the product of a p x q matrix A and a q x r matrix B. The result, a p x r matrix, is accumulated in C. The routine assumes that the first element of each matrix has the suffix (1,1). A typical call sequence might be mat mult(N, x, y, 20, 20, 1) where N, x, y had been declared byarrayN(1:20,1:20), x,y(1:20,1:1)

4.6SCOPE OF NAMESIn general all names are declared at the head of a routine either in the routine heading or by the declarationsinteger,real,array, etc., and the various routine specifications. Therefore they are local to that routine and independent of any names occurring in other routines. However, if a name appears in a routine which has not been declared in one of the above ways, then it is looked for outside i.e. in the routine or block in which it is embedded. If it is not declared there it is looked for in the routine or block outside that and so on until the main block is reached. Now the main block is itself embedded in a permanent block at 'zero level' which contains the PERMANENT material, so that if a name is not found in the main block it is looked for among these. The permanent names may in fact be redeclared locally at any level, but clearly it would be unwise to assign new meanings to such routines as 'log', 'print', etc. This outer block also contains supervisory material for controlling the entry to and exit from the main block. Very often, the only non-local names used in a routine will be the permanent names. The level at which a name is declared is sometimes referred to as its 'textual' level.PERMANENT ROUTINESThe permanent names include the standard functions, sin, log, int, etc. and the basic input/output routines read, print etc. These routines are used in a program without declaration and without the necessity of inserting the routine bodies, since these are permanently available at level zero. A full list of the permanent routines is given in Appendix 2. [NOTE : the standard functions (and the same applies to 'read') are not strictly routines :THEIRNAMESCANNOTBESUBSTITUTEDASACTUALPARAMETERSINPLACEOFFORMALPARAMETERSOFROUTINETYPE. they would first have to be redefined and renamed as formal routines.]

5.1 5.INPUT AND OUTPUT OF DATAThe input and output of data will generally be accomplished by means of permanent routines. In this section these permanent routines are described and the precise form of data is given.SELECTION OF DATA CHANNELSThe selection of an input channel is performed by the routine:-routine specselect input (integeri) This selects the input channel corresponding to the value of i, and this channel, together with the particular input device assigned to it in the Job Description (see section 7), remains selected until another 'select input' instruction is encounted. Output channels are selected in a similar way, by means of the routine:routine specselect output (integeri) In both cases channel 0 is initially selected, and in the absence of a channel selection instruction, remains selected during the execution of a program.BASIC INPUT ROUTINESDecimal numbers may be read from a data tape by means of the routineroutine specread([VARIABLE]) This reads a decimal number from the currently selected data channel and places it in the location specified by the [VARIABLE], which may be of typeintegerorreal. The routine reads numbers in either fixed or floating point form, for example:- -0.3101 18 7.132α-7 3.1872α14 A number is terminated by any character other than a decimal digit, the first decimal point, or an exponent. An exponent consists of a followed by an optional number of spaces, an optional sign, and the decimal digits. Spaces and newlines proceeding a number are ignored, but all other symbols cause the routine to signal a fault (but see NOTE on P5.4). A fault is also indicated if a number assigned to anintegervariable is not integral.

5.3 The second allows the next symbol on the data tape to be inspected without moving on to the following one. It isinteger fn specnext symbol The third:-routine specskip symbol passes over the next symbol without reading it. A table of numerical equivalents and a description of the formation of compound symbols is given in Appendix 5. It is in testing symbols that the alternative form of a constant is useful. For example, we could test if the next symbol on a tape were an asterisk by ->1ifnext symbol = 14 or ->1ifnext symbol = '*' Since spaces and underlined spaces are ignored in a program, and newline and semicolon are used as terminators, special symbols are provided to represent them. Thus a space can be tested for by ->1ifnext symbol = '~~s~~' The symbols are:-~~s~~~~s~~representing a space~~s~~'' an underlined space~~s~~~~n~~~~n~~'' a newline~~;~~~~;~~'' a semi-colon If the data itself contains these special symbols, then they can be tested only by using the internal equivalent. Finally there is a permanent input routine which permits the reading of an indefinite number of decimal numbers into successive storage locations, stopping when a particular symbol on the data tape is reached. This routine isroutine specread sequence (addrs,integerp,integer namen) The formal parameter typeaddris explained in Section 9; for the present purpose it is sufficient to say that the actual parameter will be the name of a variable, representing the first location into which the numbers are to go. p is the numerical equivalent of the terminating character, and on exit from the routine, n contains the number of numbers that have been read.

6.2 Since there may be more than one statement on a line, it is not possible to tell specifically which statement is involved but the faults are printed in the order in which they are discovered. A full list of faults is given in Appendix 4 together with a brief description of their nature.RUN TIME MONITORINGDuring the running of a program certain faults may be detected both by the compiler and by the machine and its supervisor program. For example, the supervisor program detects the case where the square root of a negative argument is being requested and the compiler detects faults connected withswitchandtestinstructions. The standard procedure is to print out 2 lines of information specifying the fault and the line on which it occurs followed by a list of useful information found in the FIXED part of the stack. For example:- LINE 117 ROUTINE 90 EXP OVERFLOW ROUTINE 90 ARRAY(1:10,1:5) ARRAY(1:10,1:5) 10 5 0.3333333341α 0 -1.1249999997α -1 0.0000000000α-99 6 4 CYCLE(CURRENT VALUE = 6, FINAL VALUE = 10, INCREMENT = 1) CYCLE(CURRENT VALUE = 4, FINAL VALUE = 5, INCREMENT = 1) BLOCK 89 0.0000000000α-99 3.7152463802α 3 10 5 3 6 ARRAY(1:10,1:5) ARRAY(1:10,1:5)

6.4NOTES1: This fault print out must be interpreted with care. When the fault occurs, the fault print out routine looks in the STACK to find the fixed variables and interpret them (see section 10). Now every location in the store initially looks as if it contains a real quantity. Thus:- (i) until an integer is assigned a value, it will appear as (and be printed as) a floating point quantity (probably zero). (ii) until an array declaration is obeyed, it will appear as 2 floating- point quantities. (iii) until a cycle has been entered, it will appear as 3 floating- point quantities. Conversely, since all sub-routines of a program share the same space, then on entry to the second and subsequent routines, the stack will contain the values left by the previous routine and these will be interpreted accordingly, if the current routine does not alter them. 2: The 'CURRENT VALUE' attributed to a cycle is the value of theintegername used on the left hand side of the instruction at the time of the fault. Thus if a program consisted of a number of cycles one after other, controlled by i, and the fault were inside the last cycle, then all cycles would have the same 'CURRENT VALUE' - the current value of i. 3: Only cycles, arrays, integers and reals are distinguished. (i) forinteger name's andreal name's the address of the actual paramter is printed (as an integer) . (ii) forarray fn's (see Section 9) its parameters are printed (as integers). (iii) forroutinesandfunction's used as parameters, six real quantities are printed. (iv) forcomplexquantities, the real and imaginary parts are printed in floating point style.

6.5FAULT TRAPPINGThe above standard monitoring procedure involving the termination of the program, is not always convenient. For example if a program is dealing with a series of data sets, it may be preferable to restart on the next 'case' in the event of (say) EXP OVERFLOW rather than terminate the entire job. An instruction is provided which enables the user to trap certain faults and transfer control to some preassigned point in the program. It takes the form:-fault[FAULT LIST] where [FAULT LIST] = [N-LIST]->[N] [REST OF FAULT LIST] For example:-fault1,2,5 ->18, 3,4 ->10 means 'if a fault of type 1,2 or 5 subsequently occurs then jump to label 18 ; and if a fault of type 3 or 4 occurs then jump to label 10. The effect is to preserve all the necessary control data to enable control to revert to this point in the program (and then jump to label 18 or 10) should one of the specified types of faults occur at some lower (or the same) level. The label must be in the same block as the trapping statement, which will usually be in the 'main' block at (say) level 1 or 2. Thefaultinstruction has dynamic significance, and a following fault instruction can change this trapping action. All faults not referred to by afaultinstruction are dealt with in the usual way (i.e. they cause the program to be terminated). The first two lines of the standard fault monitoring are printed for faults trapped in this way. Appendix 4 contains the list of faults which can be trapped and the corresponding fault numbers.FAULT DIAGNOSISProvision is made to compile certain checking facilities in selected parts of the program. Having been compiled they can then be switched on or off at run time by means of instructions in the program. The formats are:-compile[check]stop[check] [check]on[check]off

8.5INPUT-OUTPUT OF COMPLEX NUMBERSData is punched in the form [REAL PART] ±i[IMAGINARY PART] but the individual parts can be punched in any acceptable 'real' form. Both parts must be punched however. For example:- 3+i4 0+i1 -0.5+i0 1.17α3 -i2.13α4 They may be read by the instruction read(Z1,Z2,Z3,Z4) The permanent routines print complex(complexz,integerm,n) print complex fl(complexz,integern) print the value of z in the form [REAL PART] ±i[IMAGINARY PART] the individual parts being printed with the aid of the correspondingrealroutines, 'print' and 'print fl', using the same digit layout parameters. For 7-hole tape this form of output is compatible with the format for punching complex data.NOTES1. Spaces are permitted except in the two number parts themselves. In these they may only appear after an α (see description of basic input routines). 2. The other input and output routines described in Section 5 havenotbeen generalised to deal with complex numbers. 3. One may of course read a pair of real numbers on a data tape as a complex number by the 'real' read instruction read(re(z),im(z))

9.1 9STORE MAPPINGTHE ADDRESS RECOVERY FUNCTIONThe absolute address of any variable is not generally known in an Autocode programme, but it may be obtained by means of a standard function. For example:- s = addr(A(0,0)) This places the address of A(0,0) into the variable s. The argument may be any variable,real,integer, orcomplexand the result is an integer giving the absolute address of the storage location allocated to that variable. Absolute addresses are used in conjunction with array functions (see below) and with the 'storage' functions integer (integern) real (integern) complex (integern) These give the contents of the address in question as an integer, real, or complex number. In the last case the real and imaginary parts of the number are assumed to be in n and n+1. The actual parameter may of course be anintegerexpression e.g., s+k-1. These functions may be employed on the left hand side of an assignment statement as well as in an expression. Thus the pair of instructions s = addr(a) real(s) = b are equivalent to a = bARRAY FUNCTIONSThe declarations of Section 2, define variables and allocate storage space for them. In this section we introduce a declaration which defines variables as the numbers contained in storage locations that have already been allocated. This is of importance in communicating between routines with theaddrtype of formal parameter and in renaming variables (see below). An example isarray fnX(s,p) which defines X(i) as therealnumber in the storage location whose address is given by s+i*p. Thus it defines a vector X(i) in terms of an origin s and a dimension parameter p.

11.1 11.THE PERMANENT ROUTINESIn Section 5, we decribed the input and output routines. The permanent material also includes routines for the solution of linear equations, the solution of systems of ordinary differential equations and operations on matrices. Further routines may be added from time to time.LINEAR EQUATIONSroutine speceqn solve(arraynameA,b,realnamedet) This routine solves the equations A(1,1)x(1) + A(1,2)x(2) +....+ A(1,n)x(n) = b(1) A(2,1)x(1) + A(2,2)x(2) +....+ A(2,n)x(n) = b(2) ' ' ' ' ' ' ' ' ' A(n,1)x(!) + A(n,2)x(2) +....+ A(n,m)x(n) = b(n) (i.e. Ax = b), where the coefficients A(i,j) are stored in the matrix A, and b(i) in the vector b. A is destroyed and the solution is placed in b. If during the elimination process, the equations are found to be linearly dependant, then 'det' is set to zero and the routine is left, with both A and b upset, otherwise 'det' is set to the determinant of A. Consequently 'det' should be tested after each call of the routine.MATRIX ROUTINESThe matrix routines operate ontwodimensional arrays(i.e. matrices not vectors). The dimensions of the arrays are not required as parameter as the routines automatically find these from the declarations, and check them for compatibility. The programmer may insert similar tests in his own routines by means of the functionsinteger fn specdim (arraynameA)integer fn specbound (arraynameA,integern) The first gives the dimensionality of the array(1 for a vector, 2 for a matrix etc.), and the second the nth bound (upper or lower) of the array counting from left to right. For example, if A were declared by:-arrayA(-5:+5, 1:p) where p = 10 then dim(A) would have the value 2 bound(A,1) ' ' ' ' -5 bound(A,2) ' ' ' ' +5 bound(A,3) ' ' ' ' 1 bound(A,4) ' ' ' ' 10

A2.1APPENDIX 2 INDEX OF STANDARD FUNCTIONS AND PERMANENT ROUTINESAll the functions and routines listed below are declared at level 0 and hence are permanently available unless the names are redeclared locally by the user. The number in the right hand margin indicates the page on which they are described more fully.STANDARD MATHEMATICAL FUNCTIONSinteger fn specintpt(realx) 2.5integer fn specint(realx) 2.5integer fn specparity(integern) 2.5real fn specsin(realx) 2.5real fn speccos(realx) 2.5real fn spectan(realx) 2.5real fn speclog(realx) 2.5real fn specexp(realx) 2.5real fn specsqrt(realx) 2.5real fn specarctan(realx,y) 2.5 real fn spec radius(realx,y) 2.5real fn specarcsin(realx) 2.5real fn specarccos(realx) 2.5real fn specfracpt(realx) 2.5real fn specmod(realx) 2.5real fn specre(complexz) 8.1real fn specim(complexz) 8.1real fn specmag(complexz) 8.1real fn specarg(complexz) 8.1complex fn speccsin(complexz) 8.1complex fn specccos(complexz) 8.1complex fn specctan(complexz) 8.1complex fn specclog(complexz) 8.1complex fn speccexp(complexz) 8.1complex fn speccsqrt(complexz) 8.1complex fn specconj(complexz) 8.1STORAGE FUNCTIONSinteger fn specaddr(addrs) 9.1integer fn specinteger(integers) 9.1real fn specreal(integers) 9.1complex fn speccomplex(integers) 9.1MISCELLANEOUS FUNCTIONSinteger fn speccontrol no([ROUTINE NAME]) This gives the address of the first word of the routine in questioninteger fn specdim(arraynameA) 11.1integer fn specbound(array nameA,integeri) 11.1NOTE: The above classes of function cannot be substituted as an actual parameter in a routine call, since they are implimented in a different way.

A2.2INPUT ROUTINESroutine specselect input(integern) 5.1routine specread(addrs) 5.1routine specread array(array nameA) 5.2routine specread symbol(integernamei) 5.2integer fn specnext symbol 5.3routine specskip symbol 5.3routine specread sequence(addrs,integerp,integernamen) 5.3routine specread binary(integernamei) 5.6OUTPUT ROUTINESroutine specselect output(integern) 5.1routine specprint(realx,integerm,n) 5.4routine specprint fl(realx,integern) 5.4routine specspace 5.5routine specspaces(integern) 5.5routine specnewline 5.5routine specnewlines(integern) 5.5routine spectab 5.5routine specnewpage 5.5routine specrunout(integern) 5.5routine specprint array(arraynameA,integerm,n) 5.5routine specprint array fl(arraynameA,integerm) 5.5routine specprint symbol(integeri) 5.5routine specprint complex(complexz,integerm,n) 8.5routine specprint complex fl(complexz,integerm) 8.5routine specpunch binary(integern) 5.6MATRIX ROUTINESroutine specnull(arraynameA) A=0 11.2routine specunit(arraynameA) A=I 11.2routine specmatrix add(arraynameA,B,C) A=B+C 11.2routine specmatrix sub(arraynameA,B,C) A=B-C 11.2routine specmatrix copy(arraynameA,B) A=B 11.2routine specmatrix mult(arraynameA,B,C) A=B*C 11.2routine specmatrix mult'(arraynameA,B,C) A=B*C' 11.2routine specmatrix trans(arraynameA,B) A=B' 11.2routine specmatrix div(arraynameA,B,realnamedet) A=inv(B)*A 11.3routine specinvert(arraynameA,B,realnamedet) A=inv(B) 11.3real fn specdet(arraynameB) result=|B| 11.3MISCELLANEOUS ROUTINESroutine speceqn solve(arraynameA,brealnamedet) 11.1routine speckutta merson(arraynamey,realx0,x1,realnameeintegern,kroutineaux) 11.4routine specintstep (arraynamey,realx,h,integernreal namee,routineaux) 11.3

A3.1APPENDIX 3 INDEX OF DELIMITERSaddr9.1jump trace off6.5and2.9jump trace on6.5array2.4array fn9.1now compile from input7.4array bound check off6.5normal delimiters2.11array bound check on6.5own4.9begin3.1or2.9c2.11queries off6.5caption5.6queries on6.5case2.9comment2.11page2.11compile array bound check6.5production run6.7compile jump trace6.5compile queries6.5real2.3compile routine trace6.5 (real)array2.4complex8.1 (real)array fn9.1complex array8.1 (real)arrayname4.1complex array fn9.2real fn4.5complex array name8.4real fn spec4.5complex fn8.4real map9.4complex fn spec8.4real map spec9.4complex map9.4real name4.1complex map spec9.4repeat2.10complex name8.4return4.1cycle2.10result4.5routine4.1end3.2routine spec4.2end of program(me)2.11routine trace off6.5routine trace on6.5fault6.5spec4.7i8.2st10.4if.....then2.9stop2.11 .....if2.9stop array bound check6.5integer2.3stop jump trace6.5integer array2.4stop queries6.5integer array fn9.2stop routine trace6.5integer array name4.1switch2.8integer fn4.5integer fn spec4.5test2.9integer map9.4integer map spec9.4unless......then2.9integer name4.1 ......unless2.9upper case delimiters2.11

A4.2 NAME[NAME]SET TWICE The name has been used for more than one purpose at a given textual level SWITCH[NAME]OUT OF RANGE A label[NAME]([N]) appears where [N] lies outside the declared range of the switch[NAME] SWITCH[NAME]OUT OF RANGE A label[NAME]([N]) appears where [N] lies outside the declared range of the switch[NAME] TOO MANY REPEATS Too manyrepeat's in a block or routine [NAME] =ST NOT VALID The [NAME] is non-local RESULT OUT OF CONTEXT Aresult= [EXPR] statement appears in a routine other than a function or map routine NON-INTEGER CYCLE VARIABLE The controlled variable is not an integerRUN TIME FAULTS1. The following faults are monitored at run time. Normally they cause the program to be terminated but it may be restarted by afaultinstruction. The relevant fault numbers appear in the tables below. For those numbers not appearing, reference should be made to the ABL Manual. DIV OVERFLOW Division by 0 or a non-standard numberfault1 EXP OVERFLOW Exponent overflowfault2 SQRT -VE Sqrt of a negative argumentfault5 LOG -VE Log of a negative argumentfault6 INV TRIG FN OUT OF RANGE In inverse trig function e.g.,fault8 arcsin when the argument is not within range (-1,+1) INPUT ENDED Insufficient data so that a readfault9 instruction effectively reads over the end of the data tape SPURIOUS CHARACTER IN DATA Spurious character (i.e. NOTfault14 a decimal digit, point, sign, or α) appears in data. MORE THAN 3 SYMBOLS IN POSITIONfault15 A compound character formed from more than 3 superimposed characters has been encounted in textual data. REAL QUANTITY INSTEAD OF INTEGER IN DATAfault16 FAULT IN COMPLEX DATA the complex data is not punchedfault17 according to the conventions of P8.5

B1.1AtlasAutocodeReferenceManualAmendments for COMPILER AB The major deviations of AB from the AA description are: Nocomplex. Ignore all references to same. Notest-case. Use a sequence of conditions. No routine or jump tracing. No distinction betweenreal....andinteger[EXPR]s. Noarrayorinteger arrayformal parameters. Nomaps,array fns,ownvariables. New program map and stack print, see attached examples. A detailed (but incomplete) list of textual alterations follows. 2.6 after line 3 ''2.5a1b means 2.5*a1*b' insert ''c(b+1) means c*(b+1) if c is a scalar, but 2|a+b| is not allowed for 2*|a+b|; * before | | may not be omitted.'' 2.6 NOTES 3/4: replace lines 8-15 ''In the formation ... must be positive.'' by ''a² or a↑2 is compiled as a*a. All other cases of a ↑ n are distinguished at run time by subroutine: if (i) n = int (n) > 0, result = a*...*a (ii) n = 0, result = 1 (iii) n = int (n) < 0, result = 1/a*...*a (iv) n ≠ int (n) and a > 0, result = exp (n*log(a)) '' 2.7 ARITHMETIC ASSIGNMENTS: replace lines 10-13 ''but if the l.h.s. ... an integral value'' by ''but if the l.h.s. isintegerand the r.h.s. turns out at run time to be non-integral, it will be rounded to the nearest integer. For example, if i is of typeinteger, i = 2.7 will leave 3 in i.'' 2.9 CONDITIONAL LABELS: delete this section. 2.9 CONDITIONAL OPERATORS: replace line 11 ''[EXPR] ... ([COND])'' by ''[EXPR]ø[EXPR] or ([COND])'' 4.3 FORMAL PARAMETERS AND ACTUAL PARAMETERS: delete entry 4 of the table ''integerarray... explained below)'' 4.5 FUNCTION ROUTINES: insert after the end ''There is no distinction betweeninteger fnandreal fn, and both may be writtenfn.'' 4.9 OWN VARIABLES: delete this section.

B1.2 6.1-6.3 COMPILER / RUN TIME MONITORING: The examples on pp. 6.3,6.1,6.2 should be replaced by those on pp. B1.3 - B1.4 in order. Note that the first line of program is line 1. 6.5 FAULT DIAGNOSIS: delete lines 7-8 '[check] on [check] off'' 6.6 delete lines 3-23 ''The second pair ... entire program.'' 6.6 replace line 25 ''[check] a ..'' by ''[check] =queries,array bound check'' 6.7 ROUTINE TRACING: delete this section 6.7 JUMP TRACING: delete this section 6.7 OTHER CHECKING FACILITIES: insert after the end ''the checks may be restored again bynormal run'' 6.7 After the end of the chapter insert a new section ''USEOFB-LINESATCOMPILETIMEIf the program fails in compiling B49 should contain the current line number. Various aspects of compiling are controlled by digits of B2, and can be altered by compile time machine instructions (see section 10.1a)*. Initially B2 = 0. i | B2 & 2↑i ≠ 0 | B2 & 2↑i = 0 | --|-------------------------|---------------------------| 2 |ignorequeries|compilequeries| 4 |productionrun|normalrun| 7 | print compiled code | don't print compiled code | 8 | don't print program map | print program map | 9 |uppercasedelimiters|normaldelimiters| -------------------------------------------------------- *Amendment on this page 8.1-8.5 COMPLEX ARITHMETIC: delete this chapter 9.1-9.3 ARRAY FUNCTIONS: delete this section 9.4 STORE MAPPING ROUTINES: delete this section 10.5 MACHINE CODE FORMATS; insert after subsection 1 ''1a. If such an instruction is followed by =, it is obeyed immediately on compilation, not at run time.'' APPENDICES: delete all inapplicable syntax definitions, andcomplexlibrary routine specs. A1.4 line 13 ''PHRASE (CR) [program] = programme, program" delete "programme'' A2.1 MISCELLANEOUS FUNCTIONS: delete line 1 ''integer fn speccontrol no ([ROUTINE NAME])'' A4.1 COMPILING TIME FAULTS subsection 3: delete lines 3-4 ''REAL [NAME] IN EXPR REAL CONST IN INTEGER EXPR''