From: Eric S. Raymond Date: Thu, 24 Jun 2004 13:14:57 +0000 (+0000) Subject: Index complete up to "CONTINUE Statement". X-Git-Tag: 1.0~19 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=98f20028980934baa9637a1fc7b070bd203d029e;p=mad.git Index complete up to "CONTINUE Statement". --- diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 0487e86..dadc9f7 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -54,11 +54,11 @@ Most of this document is a faithful transcription of the reference manual for MAD (Michigan Algorithm Decoder), an early academic computer language from 1962. The manual should be -accompanied by an implementation; if not, it can be found at the Retrocomputing Museum. MAD has been revived -as a work of reconstructive archeology, so that language connoisseurs -of the present and future will be able to appreciate what computing -life was like back in that day. +accompanied by an implementation; if not, it can be found at the +Retrocomputing Museum. MAD has +been revived as a work of reconstructive archeology, so that language +connoisseurs of the present and future will be able to appreciate what +computing life was like back in that day. MAD was an extended dialect of ALGOL 58, first released in 1959 near the beginning of the great age of invention in compiled languages @@ -87,7 +87,7 @@ enough to write any new ones) could actually be part of pipelines! Punched-card input also explains some syntactic features that -will seem strange to modern eyes. MAD statement labels lack a +will seem bizarre to modern eyes. MAD statement labels lack a delimiter like C's trailing colon because they were distinguished by position (columns 1 to 10) on the card. The line continuation syntax, a digit in column 11, also relies on character position. In the late @@ -439,6 +439,11 @@ the original. Notably, "section 1.1" becomes "Section 1.1" (capitalized) and expressions like "sections 1.1.4 and 3.2" become "Section 1.1.4 and Section 3.2". +The reference structure of the index has been faithfully +reproduced, but DocBook renders it differently. The original lacked +the canned section headings, and references were by page number +rather than section name. + EPSLON and COMPLX and the like are not typos. As pointed out earlier, MAD variable names are limited to the 6 characters in a six-bit character set that would fit in the IBM 704's 36-bit @@ -754,7 +759,9 @@ arithmetic can be done more simply and efficiently, usually with less round-off error, than arithmetic on non-integers. [Numbers which may have fractional parts are usually written in the so-called "scientific notation", such as 3.1 × 10-6 are called -floating point numbers.] Numbers are assumed to be in the +floating point numbers.] +Constants, Floating Point +Numbers are assumed to be in the floating-point mode unless otherwise declared, as in the INTEGER statement in the example. The WHENEVER statement above is to be interpreted in the sense: Whenever the following condition (in this @@ -770,10 +777,10 @@ which can be labelled "True" or "False" is exactly what is needed here. Such expressions are called BooleanAfter the logician George Boole. -expressions, and usually involve "and", "or", -"not", and possibly other such words connecting shorter expressions -involving <, ≤, =, ≠, >, and ≥. For example, the -following is a Boolean expression: +expressionsBoolean, +and usually involve "and", "or", "not", and possibly other such words +connecting shorter expressions involving <, ≤, =, ≠, >, +and ≥. For example, the following is a Boolean expression: ((x - 3)3 < y and i ≤ j) or x ≥ 3 @@ -1059,23 +1066,25 @@ incrementing of i is not really necessary. +missing continuation punches everywhere but in INTERNAL FUNCTION F. --> &newton2; The first statement, labelled GAMMA, would cause the program to -read from the data card the numbers a, b, c, x0, -ε1, ε2, and -n0. The format of the input information is to -be found in a block of storage labelled "CARD" whose values are set -later in the program by a VECTOR VALUES statement. The vector CARD -actually has as values the format information in alphabetic form -(sometimes called HOllerith, or binary-coded decimal (BCD) form). The +read from the data card the numbers a, b, c, +x0, ε1, +ε2, and n0. The +format of the input information is to be found in a block of storage +labelled "CARD" whose values are set later in the program by a VECTOR +VALUES statement. The vector CARD actually has as values the format +information in alphabetic form (sometimes called HOllerith, or +binary-coded decimal +(BCD)BCD form). The con­struction and analysis of format information is thoroughly -discussed in Chapter II. +discussed in Chapter II. + The second statement in the program causes the inout information, @@ -1111,11 +1120,15 @@ one set of data to another. Constants +Constants + There are four classes of constants: Integer, floating point, alphabetic, and Boolean. Integer Constants +Constants, Integer + Integer constants contain from 2 to 10 decimal digits. The decimal point is assumed to be immediately to the right of the rightmost digit, but is always omitted. Integers @@ -1134,6 +1147,8 @@ of MAD implements the original MAD behavior. Floating Point Constants +Constants, Floating Point + Floating point constants may be written with or without exponents. If written without an exponent, the constant contains from one to eight digits and a decimal point ".", which must be written, @@ -1159,10 +1174,12 @@ constants with exponent are; "-" sign. Positive constants may be preceded by a "+" sign. -Alphabetic Constants An alphabetic -constantAlphabetic Constants -consists of from one to six admissible -charactersAdmissible +Alphabetic Constants + +An alphabetic constant Alphabetic +Constants Constants, +Alphabetic consists of from one to six +admissible charactersAdmissible Characters preceded and followed by the character "$". The admiss- ible characters include all letters of the alphabet, the digits 0 through 9, the special characters +, -(minus @@ -1170,11 +1187,12 @@ sign), -(dash), *, /, =, ). (. ., the comma "," and the blank space, to be represented here occasionally (but not punched on input cards), as the character "□". Thus the following are alphabetic constants: $ABCD$, $TO BE$, $DEC. 4$, $5 +3=8$. Note that blank -spaces, while ignored elsewhere in the language, count as characters -in alphabetic constants. An alphabetic constant is stored internally -as an integer, and any constant containing fewer than six characters -will be extended to six characters by adding blanks on the right; thus -$ABCD$ will appear internally as $ABCD□□$ +spacesBlank Spaces, while +ignored elsewhere in the language, count as characters in alphabetic +constants. An alphabetic constant is stored internally as an integer, +and any constant containing fewer than six characters will be extended +to six characters by adding blanks on the right; thus $ABCD$ will +appear internally as $ABCD□□$ The Retrocomputing Museum implementation neither enforces @@ -1184,8 +1202,13 @@ machine word. Boolean Constants + + +Constants, Boolean + There are two Boolean constants – "true", which is written -1B, and "false" which is written 0B. +1B, and "false" which is written 0B. +Boolean Constants Variables @@ -1238,7 +1261,7 @@ and COS. (X) are values of functions. Arithmetic Operations The following arithmetic operationsArithmetic -Operattions are available: +Operations are available: Addition, written as "+", e.g., Z5 + D. @@ -1295,8 +1318,9 @@ E * F, E/F, E.P.F, and (E)..ABS. Boolean Operations -The following Boolean, or logical, oeprations are available in the -language (where M and P are boolean expressions): +The following Boolean, or logical, operations +Boolean Operations + are available in the language (where M and P are boolean expressions): .NOT.M has the value 1B if and only if M has the value @@ -1326,7 +1350,9 @@ usual logical operations, ~, ∨, ∧, ⊃, and ≡. Boolean Expressions -Boolean expressions are defined inductively as follows: +Boolean expressions are defined inductively as follows: +Boolean Expressions + Boolean constants, Boolean individual variables, @@ -1434,7 +1460,7 @@ if any operand of any arithmetic expression in the expression is in the floating point mode. If all operands are integer (or alphabetic), then the expression is conisdered to be in the integer mode. In this determination arguments, though not values, of functions are -ignored. +ignored.Compound Expression Thus, if Y, Z, and W are floating point variables, while the function GCD. and the variables I and J are in the integer mode, then @@ -1638,10 +1664,14 @@ is SWTCH(6)). Conditional Statements +Conditional Statement + There are two types of conditional statements. (a) Simple Conditional +Conditional, Simple + WHENEVER B,Q @@ -1757,6 +1787,8 @@ is not required but contributes to the readability. CONTINUE Statement +CONTINUE Statement + This statement has the simple form: @@ -2197,20 +2229,21 @@ specification vector (see ) which must be an integer variable name. &scriptN; is an expression whose value is to be either a tape number or a drum number. &scriptL; is an input-output list. Elements of &scriptL; may be: 1) single variable -names or array names with subscripts;, 2) blocks of the form -A(ii, ..., in) -... A(ji, ...jn) where -the i's and j's may be any subscript expression and n ≥ 1. In -addition, when &scriptL; designates an output list, the elements of -&scriptL; may be: 3) constants or 4) expressions. Elements of a list -are separated by commas. Example of an output list: AB, D, 2.5, -MTX(1) ... MTX(N), P(14), J(I, K). Example of a list which may be -ysed either for input or output: A, B, K(3), J(25*I - L), -A(K+1)... A(L*2). To completely understand the operation of -statements which make an explicit reference to "TAPE" or "DRUM" it is -advisable to read the sections of the IBM 704 Reference Manual which -describes the operation of these units (See -Restrictions below). +names or array names with subscripts;, 2) +blocksblocks. Input-Output +of the form A(ii, ..., +in) ... A(ji, +...jn) where the i's and j's may be any +subscript expression and n ≥ 1. In addition, when &scriptL; +designates an output list, the elements of &scriptL; may be: 3) +constants or 4) expressions. Elements of a list are separated by +commas. Example of an output list: AB, D, 2.5, MTX(1) ... MTX(N), +P(14), J(I, K). Example of a list which may be ysed either for input +or output: A, B, K(3), J(25*I - L), A(K+1)... A(L*2). To completely +understand the operation of statements which make an explicit +reference to "TAPE" or "DRUM" it is advisable to read the sections of +the IBM 704 Reference Manual which describes the operation of these +units (See Restrictions below). @@ -2286,13 +2319,17 @@ address &scriptA; (where &scriptA; is an integer expression). -(j) BACKSPACE RECORD OF TAPE &scriptN; +(j) BACKSPACE RECORD OF TAPE &scriptN; +BACKSPACE RECORD statement + Move tape &scriptN; back to beginning of last record. -(k) BACKSPACE FILE OF TAPE &scriptN;, IF LOAD POINT TRANSFER TO &scriptS; +(k) BACKSPACE FILE OF TAPE &scriptN;, IF LOAD POINT TRANSFER TO &scriptS; +BACKSPACE FILE statement + Tape &scriptN; is moved backward until an en-of-file mark, the load point gap, or the load point is encountered. If an end-of-file @@ -2373,6 +2410,8 @@ data. Carriage Control +Carriage Control + Every format specification consists of a description of the allocation of available columns, and the form in which the particular information is to appear. Specifications for reading or punching cards and @@ -2488,7 +2527,12 @@ external medium as follows: F Fixed point number (Internally floating point) E Floating point number K Octal number -C Characters + + C + C Field (Format) + + Characters + @@ -2681,7 +2725,9 @@ specification 3F10.3, and the next line (or card) is described by the specification I2,K18,2C5, and the next by 7I3. It must be noted that each line (if printing is being described) is described individually here, and must include its own carriage control -(see ). +(see ). +Carriage Control + Hollerith fields @@ -2698,14 +2744,15 @@ transmittted, preceded by a count of these characters and the letter 1H1 F10.3, 6HBETA = E10.2 -were used in printing one would obtain a new page skip, because of the -one column Hollerith field containing the character "1". Then a ten -column F number would print, followed by the characters "BETA =" and a -floating point ten column field. Note that blanks are completely -ignored throughout all format specifications except when they occur as -characters in a Hollerith string. Note also, that while every field -specification of types S, I, E, F, K, and C must be followed by -commas, the comma may be omitted after a +were used in printing one would obtain a new page skip, because +of the one column Hollerith field containing the character "1". Then +a ten column F number would print, followed by the characters "BETA =" +and a floating point ten column field. Note that blanks are +completely ignored throughout all format specifications except when +they occur as characters in a Hollerith string. Note also, that while +every field specification of types S, I, E, F, K, and C must be +followed by commasComma (in +Format), the comma may be omitted after a Hollerith string of the type described here. The comma may be used, however, if desired. @@ -2716,12 +2763,15 @@ described here. The comma may be used, however, if desired. It has been stated above that a number appearing in an oversize field is pushed as far as possible to the right. In the case of C information -(characters), any information occurring in an oversize field is pushed -to the left , while in either case, unused -columns of the field are filled with blanks. Similarly, in the case -the specification describes too small a field, characters are taken -from the left end of the field until the field -is exhausted. +(characters) +C Field (Format) +Character Field (Format), +any information occurring in an +oversize field is pushed to the left , while in +either case, unused columns of the field are filled with blanks. +Similarly, in the case the specification describes too small a field, +characters are taken from the left end of the +field until the field is exhausted. Thus, if a card contins the characters: ABCDEFGHIJK in column 1 through 11, and it is read according to the specification 2C3*, the @@ -2746,7 +2796,7 @@ ABCDEF and HIJ□□□ to be read (since at most six characters can go into one word of -storage). +storage).Bocks, Input-Output Relationship between the List and the Specification @@ -2920,8 +2970,9 @@ of such mode declarations but a name may not be declared to be of two different modes. All constants are automatically assigned modes by the translator -(see ). Other automatic assignments of -modes are: +(see Constants +). Other automatic assignments of modes are: @@ -3300,10 +3351,11 @@ function (but used in its evaluation), are understood to be the same as elsewhere in the main program, and the current values of these variables and functions will be used. Names of variables and functions which occur as arguments of the function being defined are -designated "dummy arguments" (or "bound variables"). They must be -distinct from those appearing elsewhere in the program. The modes of -dummy arguments (if other than normal mode) must be declared in the -usual way, but arraysArray +designated "dummy arguments" (or "bound +variables")Bound Variables. +They must be distinct from those appearing elsewhere in the program. +The modes of dummy arguments (if other than normal mode) must be +declared in the usual way, but arraysArray Variables which are arguments need not be dimensioned. @@ -3549,6 +3601,7 @@ in Chapter 4). ERROR. SETETT. COMMNT. TAPERD. TAPEWR. PUNCH. SETERR. +COMMNT Subroutine If a block designation @@ -3750,7 +3803,7 @@ NORMAL MODE IS BOOLEAN could have been used as tthe second statement of this program -instead of the BOOLEAN declaration. +instead of the BOOLEAN declaration.Boolean @@ -4090,6 +4143,9 @@ only as an example problem. Business Data Processing Examples + +Business Data Processing Examples + Example 1<emphasis role='note'>: Payroll Processing</emphasis> Problem: Compute the social security deduction @@ -4664,6 +4720,8 @@ arguments of recursive functions. Card Format +Card Format + MAD Statements are punched according to the following card format: @@ -4675,10 +4733,12 @@ arguments of recursive functions. 1.1 Statement labels may be punched anywhere in cols. 1-10. Spaces are not relevant. -1.2 Column 11 is used to designate a remark (R) or, alternatively, a -continuation of a statement (0, 1, 2, ..., 9). The digits used to -indicate continuation cards need not be in any particular order but -there may be at most 10 cards in a statement. +1.2 Column 11Column 11 (Card + Format) is used to designate a remark (R) or, + alternatively, a continuation of a statement (0, 1, 2, ..., 9). The + digits used to indicate continuation cards need not be in any + particular order but there may be at most 10 cards in a + statement. 1.3 The statement may start anywhere in cols. 12-72. With the exception of characters enclosed between "$" spaces are not relevant. @@ -4823,12 +4883,13 @@ on, and the names by which the routine itself is referred to. The symbolic names of the subroutines called on must appear as the first words after this information. -The execution of MAD programs requires the use of a loading routine to -relocate and store the program and subroutines. A slightly modified -BSS FORTRAN loader is automatically produced by the University of -Michigan executive routine. Also there are certain subroutines which -may be automatically called for by a MAD program without an explicit -reference to them in the source program. +The execution of MAD programs requires the use of a loading +routine to relocate and store the program and subroutines. A slightly +modified BSS FORTRAN loaderBSS Fortran +Loader is automatically produced by the +University of Michigan executive routine. Also there are certain +subroutines which may be automatically called for by a MAD program +without an explicit reference to them in the source program. Systems Subroutines @@ -4893,7 +4954,9 @@ The arguments are the same as PRINT and the PUNCH FORMAT -COMMNT +COMMNT +COMMNT Subroutine + Entry to this subroutine causes BCD informtion to be printed on the attached (on-line) printer. The arguments are the same as PRINT except that the line spacing is not @@ -4925,14 +4988,16 @@ SETERR.(S), where S is an expression in statement label mode designating a point of return after an illegal data character or illegal format specification has been encounterered by an -input-output subroutine. +input-output subroutine.Bocks, +Input-Output -It should be understood thatthe subroutines described above may be called by other subroutines as well as statements. Thus, for example, -SETEOF is called by TAPERD, TAPEWR calls PRINT, and all of the -input-output routines call ERROR. +It should be understood thatthe subroutines described above may +be called by other subroutines as well as statements. Thus, for +example, SETEOF is called by TAPERD, TAPEWR calls PRINT, and all of +the input-output routines call ERROR. @@ -5879,11 +5944,21 @@ either is changed the elements of V must be recomputed. The usual subscript restrictions still hold, i.e. i ≤ 0, (V(i)+j) ≤ 0. For example, if A is a 4 x 3 matrix (m = 4, n = 3) and b = 1, then V(1) = 0, V(2) = 3, V(3) 6, and V(4) = 9. + +Index ArrayVector - +BCD (Hollerith)Hollerith (BCD) +Call For FunctionFunction Call +Calling SequenceFunction Call +Characters, AdmissibleAdmissible Characters +Conditional, CompoundCompoound Conditional +Conditional, SimpleSimple Conditional + + +