Algol 60 Sample Program

Sample Program For Church

SOS ALGOL 60 REFERENCE MANUAL. SAMPLE PROGRAM 12 PROCEDURES 33. An ALGOL program consists of a string of letters. For our ALGOL 60 sample program we'll have a quick look at implementing a solution to the Josephus problem.

Algol 60 is a very nice programming language, and probably would have become extremely popular if it were not for the I/O problem. Because the Algol 60 document did not provide for any I/O, it was provided in ad-hoc ways by various compiler writers. No two I/O systems were compatible with one another, so it was not possible to write a 'Hello World' program that would run on more than one implementation.

Another serious problem is the way ALGOL 60 keywords were defined. Graphisoft Ac16-3006 X64. Keywords like WHILE were not to be considered strings of characters, they were to be interpreted as symbols like + or /.

At the time Algol 60 was defined, compiler technology had not advanced to the point were it was understood how to handle keywords and reserved words. Some compilers forced programmers to put all keywords in quotes, which was permitted by the language definition. The old Z80 compiler that is still available on the web uses this convention, as did the IBM 360 ALGOL compiler. Another alternative is to force all variables to be in lower case and all keywords be in upper case. Our example below follows this convention. The Z80 compiler also uses this convention. It looks at the keyword 'BEGIN' to determine which convention you've used.

If you use the quoted keyword convention, you also must use upper case for your variables. The formal definition of the language permitted the use of both upper and lower case, which was unusual at the time. Also, arithmetic operations were supposed to be designated by standard mathematical symbols.

An 'x' was to be used for multiplication and a line with dots above and below was to be used for integer division. Obviously, this did not motivate computer manufacturers to include such symbols in their equipment, so in actual implementations, the now conventional symbols * and / were used.

Logical operations included AND, OR, NOT, and IMPLICATION, which were also intended to be specified by standard mathematical symbols. In implementations the keywords AND, OR, NOT, and IMPLY took the place of the special symbols.

My first ALGOL 60 program (circa 1969) was written in an all upper case dialect with no quotes on the keywords. This was the implementation provided by the Dartmouth Time Sharing System, the system that first gave us the BASIC language. The program below compiles and runs correctly on, This compiler requires that the program be terminated by the extra keyword 'FINISH,' which is non-standard. Formally, an Algol 60 program is any single Algol 60 statement, including compound statements created with BEGIN/END pairs. I found this compiler extremely difficult to figure out, so if you want to use it, do the following. Store your program with the suffix '.alg' and make sure the part of the file name before the period is no longer than 8 characters. Compile your program using the following command, replacing x.alg with the real file name: Algol x.alg 3.