Invoking the ALGOL/M Compiler and Run-Time System ALGOL/M Reserved Words ALGOL-M LANGUAGE DESCRIPTION ALGOL-M LANGUAGE DESCRIPTION -- Type Declarations ALGOL-M LANGUAGE DESCRIPTION -- Arithmetic Processing ALGOL-M LANGUAGE DESCRIPTION -- Control Structures ALGOL-M LANGUAGE DESCRIPTION -- Input/Output ALGOL-M LANGUAGE DESCRIPTION -- Disk Access ALGOL-M Compiler Error Messages ALGOL-M Run-Time Error and Warning Messages :Invoking the ALGOL/M Compiler and Run-Time System ALGOL/M is invoked by typing -- ALGOLM filename $option where 'filename' is the name of the file 'filename.ALG' which contains the source of the ALGOL/M program. Upon executing this command, ALGOL/M will compile this source program into the pseudo code file 'filename.AIN' which can then be executed by typing -- RUNALG filename where 'filename' is the name of the file 'filename.INT' which contains the ALGOL/M pseudo code. The options recognized by the ALGOL/M Compiler are -- $A Generate a listing at the terminal $E Set Trace Mode for execution under RUNALG $AE Do Both of the above :ALGOL/M Reserved Words AND ARRAY BEGIN CASE CLOSE DECIMAL DO ELSE END FILE FUNCTION GO GOTO IF INTEGER NOT OF ONENDFILE OR PROCEDURE READ STEP STRING TAB THEN TO UNTIL WHILE WRITE WRITEON :ALGOL-M LANGUAGE DESCRIPTION Although ALGOL-M was modeled after ALGOL-60, no attempt was made to make it a formal subset of ALGOL-60. This was done intentionally in order to provide a language which would be best suited to the needs of applications programmers using microcomputer systems. However, the basic structure of ALGOL-M is similar enough to ALGOL-60 to allow simple conversion of programs from one language to the other. This was considered particularly important in view of the fact that the standard publication language is ALGOL-60. Therefore, there exists a large source of applications programs and library procedures which can be simply converted to execute under ALGOL-M. :ALGOL-M LANGUAGE DESCRIPTION -- Type Declarations ALGOL-M supports three types of variables: integers, decimals, and strings. Integers may be any value between -16,383 and +16,383. Decimals may be declared with up to 18 digits of precision and strings may be declared as long as 255 characters. The default precision for decimals is ten digits and the default length for strings is ten characters. Decimal and string variable lengths may be integer variables which can be assigned actual values at run-time. Another form of declaration in ALGOL-M is the array declaration. Arrays may have up to 255 dimensions with each dimension ranging from 0 to +16,383. The maximum 8080 microprocesor address space of 63k bytes limits practical array sizes to something smaller than the maximum. Dimension bounds may be integer variables with the actual values assigned at run-time. Arrays may be of type integer, decimal or string. :ALGOL-M LANGUAGE DESCRIPTION -- Arithmetic Processing Integer and binary coded decimal arithmetic are supported under ALGOL-M. Integers may be used in decimal expressions and will be converted to decimals at run-time. The integer and decimal comparisons of less-than (<), greater-than (>), equal-to (=), not-equal-to (<>), less- than-or-equal-to (<=), and greater-than-or-equal-to (>=) are provided. Additionally, the logical operators AND, OR and NOT are available. :ALGOL-M LANGUAGE DESCRIPTION -- Control Structures ALGOL-M control structures consist of BEGIN, END, FOR, IF THEN, IF THEN ELSE, WHILE, CASE and GOTO constructs. Function and procedure calls are also used as control structures. ALGOL-M is a block stuctured language with a block normally bracketed by a BEGIN and an END. Blocks may be nested within other blocks to nine levels. Variables which are declared within a block can only be referenced within that block or a block nested within that block. Once program control proceeds outside of a block in which a variable has been declared, the variable may not be referenced and, in fact, run-time storage space for that variable no longer exists. Functions, when called, return an integer, decimal or string value depending on the type of the function. Procedures do not return a value when called. Both functions and procedures may have zero or more parameters which are call by value and both may be called recursively. :ALGOL-M LANGUAGE DESCRIPTION -- Input/Output The ALGOL-M WRITE statement causes output to the console on a new line. The desired output is specified in a write list which is enclosed in parentheses. String constants may be used in a write list and are characterized by being enclosed in quotation marks. Any combination of integer, decimal and string variables or expressions may also be used in a write list. A WRITEON statement is also available which is essentially the same as the WRITE statement except that output continues on the same line as the output from a previous WRITE or WRITEON statement. When a total of 80 characters have been written to the console, a new line is started automatically. A TAB option may also be used in the write list which causes the following item in the write list to be spaced to the right by a specifed amount. Console input is accomplished by the READ statement followed by a read list of any combination of integer, decimal and string variables enclosed in parentheses. If embedded blanks are desired in the input for a string variable, the console input must be enclosed in quotation marks. A READ statement will result in a halt in program execution at run-time until the input values are typed at the console and a carriage return is sent. If the values typed at the console match the read list in number and type, program execution continues. If an error as to number or type of variables from the console occurs, program execution is again halted until values are re-entered on the console. :ALGOL-M LANGUAGE DESCRIPTION -- Disk Access ALGOL-M programs may read data from, or write data to, one or more disk files which may be located on one or more disk drives. When file input or output is desired, the appropriate READ or WRITE statement is modified by placing a filename identifier immediately after READ or WRITE. The actual name of the file may be assigned to the file name identifier when the program is written or it may be assigned at run-time. Various disk drives are referenced by the letters A through Z. A specific drive may be specified by prefixing the actual file name with the desired drive letter followed by a colon. Additionally, if random file access is desired, the file name identifier may be followed by a comma and an integer constant or variable. This integer value specifies the record within the file which is to be used for input/output. Prior to the use of a file name identifier in a READ or WRITE statement, the file name identifier must appear in a file declaration statement. The file name identifier can only be referenced within the same block (or a lower block) as the file declaration. Files are normally treated as unblocked sequential files. However, if blocked files are desired, the record length may optionally be specified in brackets after the file name identifier in the file declaration statement. :ALGOL-M Compiler Error Messages AS Function/Procedure on left hand side of assignment statement. BP Incorrect bound pair subtype (must be integer). DE Disk error; no corrective action can be taken in the program. DD Doubly declared identifier, label, variable etc. FP Incorrect file open statement. IC Invalid special character. ID Subtypes incompatible (decimal values can not be assigned to integer variables). IO Integer overflow. IT Identifier is not declared as a simple variable or function. NG No ALG file found. NI Subtype is not integer. NP No applicable production exists. NS Subtype is not string. NT For clause,Step expression,Until clause expressions are not of the same subtype.(must all be integer or decimal). PC Number of parameters in procedure call does not match the number in the procedure declaration. PD Undeclared parameter. PM Parameter type does not match the declared type. SO Stack overflow. SI Array subscript is not of subtype integer. TD Subtype has to be integer or decimal. TM Subtypes do not match or are incompatible. TO Symbol table overflow. TS Undeclared subscripted variable. UD Undeclared identifier. UF Undeclared file/function. UL Undeclared label. UP Undeclared procedure. US Undeclared simple variable. VO Varc table overflow. Possibly caused by too many long identifiers. :ALGOL-M Run-Time Error and Warning Messages ERROR Messages AB Array subscript out of bounds. CE Disk file close error. DB Input field length is larger then the buffer size. DW Disk file write error. ER Variable block size write error. IO Integer overflow(integer value greater than 16383). IR Record number incorrect or random file is not initialized. ME Disk file creation error. NA No AIN file found on directory. OV Decimal register overflow during arithmetic operation/ load. RE Attempt to read past end of record on blocked file. RU Attempt to random access a non-blocked file. SK Stack overflow(no more memory available). WARNING Messages AZ Attempt to allocate null decimal or string, system defaults to 10 digits/characters. DO Decimal overflow during store operation. The value of the variable is set to 1.0 and execution continues. The variable's allocation size should be increased in it's declaration statement. DI Disk file variable format error. DZ Decimal division by zero, result is set to 1.0. EF End of file on read. IA Integer addition/subtraction over/under flow result is set to 1. II Invalid Console Input. Try input again. IR Record number incorrect or random file is not initialized. IZ Integer division by zero. Divisor set to 1 and division is completed. NX Negative exponential. Exponentiation not done. SO Characters lost during string store.