Algol68 Articles about
Algol 68
Website Links For
Algol 68
 

Information About

Algol68




  Logo0 <!-- The front cover of the Final Report included a logo made of WINDOW characters, can someone help me find/scan this please -->
  Paradigm &bull <!-- Distributed , --><!-- Generic-programming , --> Imperative <!--, Object-oriented -->
  Year 1968, last revised 1973
  Designer A Van Wijngaarden , BJ Mailloux , JEL Peck and CHA Koster , et al
  Typing Static &bull Strong &bull Safe , Structural
  dialects ALGOL 68/FR (Final Report: 1968) &bull Algol 68/RR (Revised Report: 1973)
  Influenced By ALGOL 60 &bull ALGOL Y
  Influenced ALGOL 68C &raquo C &raquo C++ &bull Bourne Shell &raquo Bash &bull Steelman &raquo Ada &bull Python 1 &bull Maple &bull et el



TIME-LINE OF ALGOL 68





Bold Symbols and Reserved Words

There are 61 such reserved words ( some with "brief symbol" equivalents ) in the standard sub-language:
mode, op, prio, proc,
flex, heap, loc, long, ref, short,
bits, bool, bytes, char, compl, int, real, sema, string, void,
channel, file, format, struct, union,
of, at "@", is ":=:", isnt ":≠:", true, false, empty, nil "○", skip "~",
co "¢", comment "¢", pr, pragmat,


proc: Procedures

Procedure (proc) declarations require type specifications for both the parameters and the result ('''void''' if none):
proc max of real = (real a, b) real:
if a > b then a else b fi;
or, using the "brief" form of the conditional statement:

Standard dyadic operators with associated priorities:


Assignation and Identity Relations etc

These are technically not operators, rather they are considered " units associated with names "

“:=:” (alternatively “is”) tests if two pointers are equal; “:/=:” (alternatively “isnt”) tests if they are unequal.

Why :=: and :/=: are needed: Consider trying to compare two pointer values, such as the following variables, declared as pointers-to-integer:

: ref int ip, jp

Now consider how to decide whether these two are pointing to the same location, or whether one of them is pointing to nil. The following expression

: ip = jp

will dereference both pointers down to values of type int, and compare those, since the “=” operator is defined for int, but not ref int. It is ''not legal'' to define “=” for operands of type ref int and int at the same time, because then calls become ambiguous, due to the implicit coercions that can be applied: should the operands be left as ref int and that version of the operator called? Or should they be dereferenced further to int and that version used instead? Therefore the following expression can never be made legal:

: ip = nil

Hence the need for separate constructs not subject to the normal coercion rules for operands to operators. But there is a gotcha. The following calls:

: ip :=: jp
: ip :=: nil

while legal, will probably not do what you expect. They will always return false, because they are comparing the ''actual addresses of the variables ''ip'' and ''jp'', rather than what they point to''. To achieve the right effect, you have to write

: ip :=: ref int(jp)
: ip :=: ref int(nil)

Patent application: On 14 May 2003, Software Patent application No. 20040230959"IS NOT OPERATOR" - was filed for the '''ISNOT''' operator by employees of Microsoft . This patent was granted on 18 November 2004.


Special characters for operators

The ∨, ∧, ¬, ≠, ≤, ≥, ×, ÷, ⌷, ↑, ↓, ⌊, ⌈ and ⊥ characters can be found on the IBM 2741 keyboard with the APL "golf-ball" print head inserted, these became available in the mid 1960s while ALGOL 68 was being drafted.


transput: Input and output

Transput is the term used to refer to ALGOL 68's input and output facilities. There are pre-defined procedures for unformatted, formatted and binary transput. Files and other transput devices are handled in a consistent and machine-independent manner. The following example prints out some unformatted output to the '''standard output''' device:
print ((newpage, "Title", newline, "Value of i is ",
i, "and x is ", x[i , newline))
Note the predefined procedures newpage and newline passed as arguments.


Books, channels and files

The transput is considered to be of books, channels and files:


formatted transput

"Formatted transput" in ALGOL 68's transput has its own syntax and patterns (functions), with formats embedded between two $ characters.
Examples:
printf (($2l"The sum is:"x, g(0)$, m + n)); ¢ prints the same as: ¢
print ((new line, new line, "The sum is:", space, whole (m + n, 0))


par: Parallel processing

''ALGOL 68'' supports programming of parallel processing. Using the keyword par, a ''collateral clause'' is converted to a ''parallel clause'', where the synchronisation of actions is controlled using Semaphore s. In A68G the parallel actions are mapped to threads when available on the hosting Operating System . In A68S a different paradigm of parallel processing was implemented (see below).
mode foot = {Link without Title} bits; ¢ packed vector of bool ¢
 
foot left, right;
 
sema left toe = level ⌈left,
right toe = level ⌈right;
 
proc shoot left toe = void: (
shoot(left toe);
print("Left: Ouch!!");
newline
),
shoot right toe = void:(
shoot(right toe);
print("Right: Ouch!!");
newline
);
 
¢ 10 round clip in a 1955 Colt Python .357 Magnum ¢
sema rounds = level 10;
 
¢ the Magnum needs more barrels to take full advantage of parallelism ¢
sema acquire target = level 1;
 
proc shoot = (ref sema target)void: (
↓ acquire target;
↓ rounds;
print("BANG! ");
↓ target;
↑ acquire target
);
 
¢ do shooting in parallel to cater for someone hoping to stand on just one foot ¢
par (
for toe from ⌊left to ⌈left do
shoot left toe
od, ¢ <= this comma is important ¢
for toe from ⌊right to ⌈right do
shoot right toe
od
)


CODE SAMPLE

This sample program implements the Sieve Of Eratosthenes to find all the Prime Number s that are less than 100. nil is the ALGOL 68 analogue of the ''null pointer'' in other languages. The notation ''x'' of ''y'' accesses a member ''x'' of a struct ''y''.

begin # Algol-68 prime number sieve, functional style #
 
proc error = (string s) void:
(print(( newline, " error: ", s, newline)); goto stop);
proc one to = (int n) list:


SOME VANITAS

For its technical intricacies, ALGOL 68 needs a cornucopia of methods to deny the existence of something:

skip, "~" or "?"C - an undefined value always syntactically valid,
void - syntactically like a mode, but not one,
nil or "∘" - a name not denoting anything, of an unspecified reference mode,
empty - the only value admissible to void, needed for selecting void in a union,
- an empty array of integral values, with mode [ int,
''undefined'' - a procedure raising an exception in the runtime system.

The term nil is ''var'' always evaluates to true for any variable (but see above for correct use of is/:=:), whereas it is not known
to which value a comparison ''x'' < skip evaluates for any integer ''x''.

ALGOL 68 leaves intentionally undefined, what happens in case of integer overflow, the integer bit representation, and the degree of numerical accuracy for floating point. In contrast, the language Java has been criticized for over-specifying the latter.


COMPARISON TO CONTEMPORARY PROGRAMMING LANGUAGES


Except where noted (with a superscript), the language described above is that of the "Revised Report(RR)".


The language of the unrevised Report

The original language(FR) differs in syntax of the ''mode cast'', and it had the feature of ''proceduring'', i.e. coercing the value of a term into a procedure which evaluates the term. Proceduring effectively can make evaluations ''lazy''. The most useful application could have been the short-circuited evaluation of boolean operators. In

The S3 programming language that was used to write the VME operating system and much other system software on the ICL 2900 Series was a direct derivative of Algol 68. However, it omitted many of the more complex features, and replaced the basic modes with a set of data types that mapped directly to the 2900 Series hardware architecture.


Implementation specific extensions

ALGOL 68R(R) from RRE was the first ALGOL 68 subset implementation,
running on the ICL 1900 .
Based on the original language, the main subset restrictions were ''definition before use'' and no parallel processing.
This compiler was popular in UK universities in the 1970s, where many Computer Science students learnt ALGOL 68 as their first programming language; the compiler was renowned for good error messages.

ALGOL 68RS(RS) from RSRE was a portable compiler system written in ALGOL 68RS (bootstrapped from ALGOL 68R), and implemented on a variety of systems including the ICL 2900/Series 39 , Multics and
DEC VAX/VMS .
The language was based on the Revised Report, but with similar subset restrictions to ALGOL 68R.
This compiler survives in the form of an Algol68-to-C compiler.

In ALGOL 68S(S) from Carnegie Mellon University the power of parallel processing was improved by adding an orthogonal extension, ''eventing''. Any variable declaration containing keyword event made assignments to this variable eligible for parallel evaluation, i.e. the right hand side was made into a procedure which was moved to one of the processors of the C.mmp multiprocessor system. Accesses to such variables were delayed after termination of the assignment.

Cambridge ALGOL 68C (C) was a portable compiler that implemented a subset of ALGOL 68, restricting operator definitions and omitting garbage collection, flexible rows and formatted transput.

ALGOL 68G (G) by M. van der Veer implements a usable ALGOL 68 interpreter for today's computers and operating systems. A minor restriction is that ''formatted transput'' is still not conforming to the ''Revised Report''.

"Despite good intentions, a programmer may violate portability by inadvertently employing a local extension. To guard against this, each implementation should provide a PORTCHECK pragmat option. While this option is in force, the compiler prints a message for each construct that it recognizes as violating some portability constraint." {Link without Title}


QUOTES



REFERENCES





EXTERNAL LINKS