A. HISTORY OF ALGOL
The definition of the algorithmic language (ALGOL-60) was the result of the work of a committee of distinguished computer scientists and was originally published in 1960.
The purpose of the developers of ALGOL-60 was the establishment of a universal computer language specifically designed to allow for the logical and efficient program representation of algorithms. Additional versions and extensions of ALGOL-60 such as ALGOL-68 and ALGOL-W have been developed and have found acceptance primarily in the academic communities and in Europe. The language ALGOL-E is also based on ALGOL-6O and was developed as part of a complete system designed for teaching programming language concepts.
B. MICROCOMPUTER SOFTWARE
The rapid development of microcomputer hardware since 1975 has generally resulted in a considerable lag in the corresponding development of compatible Software, particularly that of high level languages. The Intel 8080 microprocessor is one of the few microprocessors which has endured long enough to permit software development to advance beyond the assembly language level. High level languages which have been developed for 8080 based systems by students at the Naval Postgraduate School include a macro assembler (ML-80), a BASIC compiler/interpreter (BASIC-E), and a COBOL compiler/interpreter (MICRO-COBOL). The majority of high level languages currently available for microcomputer based systems are extensions of the original Dartmouth BASIC and, although they allow for a reasonable level of programming sophistication, they are encumbered by the inherent limitations of the BASIC language constructs.
C. OBJECTIVES OF ALGOL-M
The major objective of this project was to develop a dynamic, block-structured, recursive high level language which would provide adequate programming power and flexibility for applications programming using microcomputer based systems. ALGOL constructs were chosen because of their simplicity and power and because it was possible to write the grammar in LALR(1) form for use with available compiler-compiler generated parse tables. ALGOL-M was developed to run on 8080 based microcomputer systems because of the availability of a high level system development language (PL/M) which produces 808O object code and which could be run on the Naval Postgraduate School's IBM 360. The availability of an 8080 based disk operating system (CP/M) simulator on the IBM 360 was also a strong factor in the choice of 8080 microprocessor and CP/M operating system.
II. ALGOL-M LANGUAGE DESCRIPTION
A. FEATURES OF THE ALGOL-M LANGUAGE
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.
1. Type Declarations
ALGOL-M supports three types of variables: integers, decimals, and strings. Integers may be any value between -16,384 and +16,384. 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 -16,384 to +16,384. The maximum 8080 microprocessor address space of 64k 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.
2. 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.
3. 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 structured 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. Additionally, functions and procedures may be referenced before they are declared.
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 specified 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 parenthesis.
Copyright 1976, John P. Flynn & Mark Moranville