From 87807776cb7dfe38f68f7212eb68417f76a3a820 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 30 Jun 2004 00:02:12 +0000 Subject: [PATCH] Index up to "Table Lookup". --- doc/mad-manual.xml | 108 +++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 32 deletions(-) diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index ea81b36..7bbbb8e 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -931,6 +931,8 @@ implied is simply that the value of the express on the right becomes the value of the variable whose name appears on the left. This is referred to as substitution. +Substitution + For our specific example, then, the evaluation of the iterative formula could be described as @@ -1229,7 +1231,8 @@ 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 -spacesBlank Spaces, while +spacesBlank Spaces +Spaces, Blank, 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 @@ -1270,8 +1273,9 @@ linkend='dimension_declaration'/>) then the name of an element of the array consists of the variable name, (i.e one to six letters or digits, starting with a letter), followed by the appropriate subscripts separated by commas and enclosed in parentheses. Thus the -following are "single variables:": X51, ALPHA6, LAMBDA, GROSS, while -the following are elements of arrays: BETA(C1, C2, 6), X15(Y, Z1), +following are "single variables:": X51, ALPHA6, LAMBDA, GROSS, +Single Variables +while the following are elements of arrays: BETA(C1, C2, 6), X15(Y, Z1), J(6), J(Z1 + 5 *Z2, 5). (See for the description of subscripts.) ParenthesesParentheses @@ -1282,12 +1286,15 @@ enclosing subscripts may not be omitted. Statement Labels +Statement Labels + A statement may be labelled or unlabelled. Labels are used to refer to a statement in other statements. A statement label consists of from one to six letters or digits, the first of which must be a letter, e.g. IN or BACK. A statement label may be an element of a -statement label vector, in which case the vector name is followed by a -constant integer subscript enclosed in +statement label vector,Statement Label +Vector in which case the vector name is followed +by a constant integer subscript enclosed in parentheses, e.g. S(2) or LBL(3). A statement label appears in the label field (i.e. columns 1-10) of the statement it identifies. When a statement extends to additional cards (i.e. cards identified by a @@ -1325,7 +1332,9 @@ Operations are available: Addition Subtraction, written as "-", e.g., Z5 - D. (Note, -both the minus sign and the dash are accepted.) +both the minus sign and the dash are accepted.) +Subtraction + Multiplication, written as "*", e.g. Z5*D. (Note that the "*" may not be omitted. It is illegal to write Z5D, since it @@ -1506,6 +1515,7 @@ otherwise indicated by parentheses. Examples: Expression, Compound +Subexpression A + B - C + D - E means (((A + B) - C) + D) - E. @@ -1519,9 +1529,10 @@ otherwise indicated by parentheses. The kind of arithmetic performed on a constant, variable or function value is determined by its mode. There are five modes in -MAD; floating point, integer, Boolean, statement label, and function -name.Function Name Floating -point, integer, and Boolean constants were described in Statement Labels and +function name.Function Name +Floating point, integer, and Boolean constants were described in . Alphabetic constants are assumed to be of integer mode. describes how the modes of variables and functions are specified. @@ -1537,7 +1548,7 @@ linkend='boolean_expressions'/>, then its mode is Boolean. An arithmetic expression is considered to be in the floating point mode 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 +then the expression is considered to be in the integer mode. In this determination arguments, though not values, of functions are ignored.Compound Expression @@ -1640,7 +1651,8 @@ floating point mode if the expression were written: originally stated just to achieve the "truncation" effect. A statement label (appearing in the label field of a statement) -is a constant of statement label mode. A function +is a constant of statement label mode.Statement +Labels A function nameFunction Name with no arguments (e.g. SIN.) is a constant of a function name mode. A single constant, variable, or function value of statement label (function @@ -1655,6 +1667,8 @@ case A.E.B. and A.NE.B are not expressions. Subscript Expressions +Subscripts + Any arithmetic expression may be used as a subscript expression for an element of a linear array. If the value of the expression is in the floating point mode (see @@ -1677,6 +1691,8 @@ MP(A, B + 6 * J, I * 6/TDX), MA(K(Z + 5) + T(1) + 6). Substitution Statement +Substitution Statement + This statement has the form illustrated by @@ -2072,6 +2088,7 @@ END WHENEVER J .E. (J/5) * 5, J = J + 2 (iv) A table-look-up procedure using an interation statement. +Table Lookup Suppose that a string of alphabetic (or numeric) characters (i.e., a "sentence") has been decomposed into single characters stored in C(1), C(2), ..., C(K), where K is the length of the string. Then the first @@ -2512,7 +2529,9 @@ subroutine which returns control to the system in which the translated program is imbedded) is automatically entered. This action can be changed by executing the statement EXECUTE SETEOF. (&scriptS;). The subroutine SETEOF. -SETEOF Subroutine +SETEOF Subroutine +SYSTEM Subroutine + sets the read routines to transfer to the executable statement labelled &scriptS; when an end-of-file is encountered. If the @@ -3125,12 +3144,13 @@ read and stored until needed. Declarations Non-Executable Statements -Declarations are non-executable statements, and, except for function -declarations, they may occur anywhere in the program. Their purpose -is to furnish information to the translator program or to the reader -of the program. Declarations may have statement labels, but these -labels are ignored by the translator, and may not be referred to in -other statements. +Declarations are non-executable statements, and, except for +function declarations, they may occur anywhere in the program. Their +purpose is to furnish information to the translator program or to the +reader of the program. Declarations may have statement +labels,Statement Labels but +these labels are ignored by the translator, and may not be referred to +in other statements. Remark Declaration @@ -3180,10 +3200,14 @@ linkend='constants'/>Constants ). Other automatic assignments of modes are: + +Single Variable + A name appearing in the statement label field is assigned statement label mode (see ). +linkend='statement_labels'/>)Statement +Labels. A function nameFunction Name constant is assigned function name mode @@ -3317,9 +3341,11 @@ subscripts are not available for vectors. Dimensioning is automatic in two situations -(a) In case a statement label vector, say L, is used (see ) and n is the highest subscript used on L -in the statement label field (i.e., if L(m) appears then m ≤ n), +(a) In case a statement label +vector,Statement Label +Vector say L, is used (see ) and n is the highest subscript used on +L in the statement label field (i.e., if L(m) appears then m ≤ n), then n + 1 locations are reserved for L. L may also appear in a dimension declaration in which case the highest linear subscript is used. @@ -3510,9 +3536,10 @@ section ) by a VECTOR VALUES statement. Vectors which have been assigned to the PROGRAM COMMON section of storage (see section 3.6) can be preset with numerical or alphabetical information only (not -statement labels or function names) and then only if it is a single -section program (i.e., storage is loaded with instructions only once) -or, if it is a multiple section program, the PROGRAM +statement labelsStatement +Labels or function names) and then only if it is +a single section program (i.e., storage is loaded with instructions +only once) or, if it is a multiple section program, the PROGRAM COMMONPROGRAM COMMON region is identical in all sections of the program. @@ -3873,7 +3900,8 @@ Declaration The name of a function with the period deleted must not be used as the name of a variable or as a statement label. A statement label -must not be identical with any variable name. +must not be identical with any variable +name.Statement Labels The translator automatically calls on some subroutines, hence the following names may not be used as variable names or statement labels @@ -3892,6 +3920,9 @@ in Chapter 4). PUNCH Subroutine READ Subroutine SETEOF Subroutine +SETETT Subroutine +SYSTEM Subroutine +Subroutines If a block designation @@ -4466,6 +4497,7 @@ compile this example. The problem is the array I/O. Business Data Processing Examples Examples, Business Data Processing +Social Security Example Example 1<emphasis role='note'>: Payroll Processing</emphasis> @@ -4910,7 +4942,9 @@ compile this example. The problem is the array I/O. Exammples, Recursive Functions Examples, Symbol Manipulation -Rrcursive Functions +Recursive Functions +Subroutines +Symbol Manipulation Examples Problem: Find the first occurrence of an arbitrary word in a given text. @@ -5165,6 +5199,8 @@ possibilities are suggested by the comment. Structure of Subroutines +Subroutines + This section describes the mechanics of writing MAD-accessible subroutines in IBM 709 assembler. For tolerably obvious reasons, the Retrocomputing Museum implementation does @@ -5197,11 +5233,11 @@ illustrative purposes, the calling sequence produced would be Input-output routines utilize two types of parametersⅆthe -regional and single variable types. In addition an error return is -given as well as a format specification location. The parameter -operation code used is TXI and the end of the parameter list is -indicated by a TXI operation with a blank address. Thus the -statement +regional and single variable types.Subroutine +Parameters In addition an error return is given +as well as a format specification location. The parameter operation +code used is TXI and the end of the parameter list is indicated by a +TXI operation with a blank address. Thus the statement READ FORMAT FMT, BETA, X(1) ... X(100), K @@ -6379,6 +6415,14 @@ example, if A is a 4 x 3 matrix (m = 4, n = 3) and b = 1, then V(1) = Precedence HierarchyParentheses R (Column 11)Remark Declaration Regional NotationBlocks, Input-Output +Specifications, FormatFormat Specifications +Statement, ExecurtableExecutable Statements +Statements, +Input-OutputInput-Output Statements +Statements, +Non-ExecutableNon-Executable Statements +Subscript, LinearLinear Subscript +Subscript, NegativeNegative Subscript -- 2.43.0