ALGOL 68 was defined using a two-level grammar formalism invented by Adriaan Van Wijngaarden . Van Wijngaarden Grammar s use a Context-free Grammar to generate an infinite set of productions that will recognize a particular ALGOL 68 program; notably, they are able to express the kind of requirements that in many other programming language standards are labelled "semantics" and have to be expressed in ambiguity-prone natural language prose, and then implemented in compilers as ''ad hoc'' code attached to the formal language parser.
The main aims and principles of design of ALGOL 68 are:
#Completeness and clarity of design, {Link without Title}
# Orthogonal design, {Link without Title}
#Security, {Link without Title}
#Efficiency: {Link without Title}
- Static mode checking,
- Mode-independent parsing,
- Independent compilation,
- Loop optimization,
- Representations - in minimal & larger character sets.
Critics of ALGOL 68, prominently C. A. R. Hoare , point out that it abandoned the simplicity of ALGOL 60 and became a vehicle for various complex ideas of its designers. The language also did little to make the Compiler writer's task easy, in contrast to deliberately simple contemporaries (and competitors) C , S-algol and Pascal .
Though European defence agencies (in Britain ) on the Russian side, then Soviet Union, was not helpful on this, either.
The ALGOL 68 heritage is acknowledged by C++ .
For a full length treatment of the language, see Programming Algol 68 Made Easy by Dr. Sian Leitch.
Edited by: A. Van Wijngaarden , B.J. Mailloux , J.E.L. Peck and C.H.A. Koster
"Van Wijngaarden once characterized the four authors, somewhat tongue-in-cheek, as: : party ideologist." -- Koster.
Edited by: A. Van Wijngaarden , B.J. Mailloux , J.E.L. Peck , C.H.A. Koster , M. Sintzoff , C.H. Lindsey , L.G.L.T. Meertens and R.G. Fisker .
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,
- Standard dyadic operators with associated priorities:
The ∨, ∧, ¬, ≠, ≤, ≥, ×, ÷, ⌷, ↑, ↓, ⌊, ⌈ and ⊥ characters can be found on the IBM 2741 terminal with the APL "golf-ball" print head, these became available in the mid 1960s while ALGOL 68 was being drafted.
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.
The is considered to be of books, channels and files:
- are made up of pages, and lines, and may be locked and selected via chains.
- --- A specific book can be located by name with a call to
match.
- channels correspond to physical devices. eg. card punches and printers.
- --- There are three standard channels:
stand in channel, stand out channel, stand back channel.
- A file is a means of communicating between a particular program and a book that has been opened via some channel.
- --- The of a file may be read, write, char, bin, and opened.
- --- transput procedures include:
establish, create, open, associate, lock, close, scratch.
- --- position enquires:
char number, line number, page number.
- --- layout routines include:
--space, backspace, newline, newpage.
--get good line, get good page, get good book, and proc set=(ref file f, int page,line,char)void:
- --- A file has . eg.
on logical file end, on physical file end, on page end, on line end, on format end, on value error, on char error.
"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))
''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} bit; ¢ 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 aqcuire 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
)
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 or union ''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:
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.
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 , 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 by enforcing ''definition before use'', restricting operator definitions and omitting garbage collection.
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}
- "ALGOL 68 was the first (and possibly one of the last) major language for which a full formal definition was made before it was implemented." C.H.A. Koster {Link without Title}
- ''... C does not descend from Algol 68 is true, yet there was influence, much of it so subtle that it is hard to recover even when I think hard. In particular, the union type (a late addition to C) does owe to A68, not in any details, but in the idea of having such a type at all. More deeply, the type structure in general and even, in some strange way, the declaration syntax (the type-constructor part) was inspired by A68. And yes, of course, "long".'' Dennis Ritchie , 18 June 1988 {Link without Title}
- "Congratulations, your Master has done it" - Niklaus Wirth , Aug 1968.
- '' it was said that A68's popularity was inversely proportional to [... the distance from Amsterdam'' [http://mail.python.org/pipermail/python-dev/2005-June/054225.html]
- 1980 quote: ' The best we could do was to send with it a minority report, stating our considered view that, "... as a tool for the creation of sophisticated programs, the language was a failure." [... ' - , Oct 1980, re: "Dec 1968"
- Original 1968 version: from , DUNCAN , GARWICK , HOARE , RANDELL , SEEGMUELLER , TURSKI , WOODGER . And then on Dec. 23, 1968, Jan V. Garwick
- Brailsford, D.F. and Walker, A.N., ''Introductory ALGOL 68 Programming'', Ellis Horwood/Wiley, 1979
- McGettrick, A.D., ''ALGOL 68, A First and Second Course'', Cambridge Univ. Press, 1978
- Peck, J.E.L., ''An ALGOL 68 Companion'', Univ. of British Columbia, October 1971
- Tanenbaum, A.S., ''A Tutorial on ALGOL 68'', Computing Surveys , 155-190, June 1976 and '''9''', 255-256, September 1977, http://vestein.arb-phys.uni-dortmund.de/~wb/RR/tanenbaum.pdf
|