FACTOID # 71: You can be imprisoned for not voting in Fiji, Chile and Egypt - at least in theory.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

Encyclopedia > ALGOL 68

ALGOL 68 (short for ALGOrithmic Language 1968) is an imperative computer programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and a more rigorously defined syntax and semantics. Contributions of ALGOL 68 to the field of computer science are deep and wide ranging, although some of them were not publicly identified until they were passed, in one form or another, to one of many subsequently developed programming languages. Imperative programming, as opposed to functional programming, is a sort of programming employing side-effect as central execution feature. ... Wikibooks has more about this subject: Computer programming Computer programming (often simply programming) is the craft of implementing one or more interrelated abstract algorithms using a particular programming language to produce a concrete computer program. ... A programming language or computer language is a standardized communication technique for expressing instructions to a computer. ... ALGOL (short for ALGOrithmic Language) is a programming language originally developed in the mid 1950s which became the de facto standard way to report algorithms in print for almost the next 30 years. ... Computer science - Wikipedia, the free encyclopedia /**/ @import /skins-1. ...


ALGOL 68 was defined using a two-level grammar formalism invented by Adriaan van Wijngaarden. Van Wijngaarden grammars 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. Adriaan van Wijngaarden (2 November 1916 - 7 February 1987) was an outstanding computer scientist who is considered by many to have been the founding father of informatica (computer science) in the Netherlands. ... Van Wijngaarden grammar is a 2-level formal grammar, also W-grammar or vW-grammar, is a technique to define potentially infinite grammars in a finite number of rules. ... In linguistics and computer science, a context-free grammar (CFG) is a formal grammar in which every production rule is of the form V → w where V is a non-terminal symbol and w is a string consisting of terminals and/or non-terminals. ...


The main principles of design are completeness and clarity of design, orthogonal design, security, efficiency, the latter by static mode checking, mode-independent parsing, independent compilation and loop optimization. In mathematics, orthogonal is synonymous with perpendicular when used as a simple adjective that is not part of any longer phrase with a standard definition. ...


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. Sir Charles Antony Richard Hoare (Tony Hoare or C.A.R. Hoare, born January 11, 1934) is a British computer scientist, probably best known for the development of Quicksort, the worlds most widely used sorting algorithm, in 1960. ... ALGOL (short for ALGOrithmic Language) is a programming language originally developed in the mid 1950s which became the de facto standard way to report algorithms in print for almost the next 30 years. ... A diagram of the operation of a typical multi-language compiler. ... The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a standardized imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ... Pascal is an imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. ...


Though European defence agencies (in Britain Royal Signals and Radar Establishment - RRSE) promoted the use of ALGOL 68 for its expected security advantages, the American side of the NATO alliance decided to develop a different project, the Ada programming language. The use of Ada was made obligatory for defence contracts. Apparently there was no room for two languages of similar application range in the NATO. Perhaps the acceptance of ALGOL 68 (Алгол 68) on the Russian side, then Soviet Union, was not helpful on this, either. The Royal Signals and Radar Establishment was a scientific research establishment within the Ministry of Defences Defence Procurement Agency of the United Kingdom, located primarily at Malvern in Worcestershire. ... Ada is a structured, statically typed imperative computer programming language designed by a team lead by Jean Ichbiah of CII Honeywell Bull during 1977–1983. ... The NATO flag NATO 2002 Summit in Prague The North Atlantic Treaty Organisation (NATO), sometimes called North Atlantic Alliance, Atlantic Alliance or the Western Alliance, is an international organisation for defence collaboration established in 1949, in support of the North Atlantic Treaty signed in Washington, D.C., on April 4...


The ALGOL 68 heritage is acknowledged by Scheme, and by C++. The Knights of the Lambda Calculus recursive emblem celebrates Schemes theoretical foundation, the lambda calculus. ... C++ (pronounced see plus plus, IPA: /siː pləs pləs/) is a general-purpose computer programming language. ...


For a full length treatment of the language, see Programming Algol 68 Made Easy by Dr. Sian Leitch.

Contents


Time-line of ALGOL 68

Year Event Contributor
Mar 1959 ALGOL Bulletin Issue 1 (First) Peter Naur / ACM
Feb 1968 Draft Report(0) Published IFIP Working Group 2.1
Jun 1968 Meeting in Tirrenia, Italy IFIP Working Group 2.1
Aug 1968 Meeting in North-Berwick, England IFIP Working Group 2.1
Dec 1968 Algol 68 Final Report(1) Presented at Munich Meeting IFIP Working Group 2.1
Apr 1970 ALGOL 68R(R) under GEORGE 3 on an ICL 1907F. Royal Signals and Radar Est.
Sep 1973 Revised Report (2)Published IFIP Working Group 2.1
___ 1975 ALGOL 68C(C) - transportable compiler (zcode VM) S. Bourne, Andrew Birrell, and Mike Guy
Jun 1977 Strathclyde ALGOL 68 conference, Scotland ACM
May 1978 Proposals for ALGOL H - A Superlanguage of ALGOL 68 A. P. Black, V. J. Rayward-Smith
___ 1980 ALGOL 68+(+) Super Language Lambert Meertens & van Vliet
___ 1984 Full ALGOL 68S(S) compiler for Sun, Sparc,and PCs C.H.Lindsey ea, Manchester
Aug 1988 ALGOL Bulletin Issue 52 (last) Ed. C. H. Lindsey / ACM
May 1997 Algol68 S(S) published on the internet Charles H. Lindsey
Nov 2001 ALGOL 68G(G) released (GNU GPL open source licensing) Marcel van der Veer

Portrait of Peter Naur taken 1968, courtesy of Robert M. McClure. ... ACM is an abbreviation and a TLA that may stand for: Association for Computing Machinery, an association of computing practitioners ACM International Collegiate Programming Contest Academy of Country Music Academic Common Market Academy of Contemporary Music (acm. ... The International Federation for Information Processing, usually known as IFIP, is an umbrella organization for national societies working in the field of information technology. ... The initialism ICL may have at least four meanings: Imperial College London, although this initialism is strongly discouraged by Imperial International Computers Ltd, the British computer hardware and services company, formerly International Computers and Tabulators Company (ICT) and others that merged with them the International Communist League Icon Library, a... The Royal Signals and Radar Establishment was a scientific research establishment within the Ministry of Defences Defence Procurement Agency of the United Kingdom, located primarily at Malvern in Worcestershire. ... The ALGOL68C computer programming language compiler was developed for the CHAOS OS for the CAP capability computer at Cambridge University in 1971 by Stephen Bourne and Mike Guy as a dialect of ALGOL 68. ... In general terms, a virtual machine in computer science is software that creates an environment between the computer platform and the end user in which the end user can operate software. ... Steve Bourne is a computer scientist, most famous as the author of the Bourne shell (sh), which remains the standard command line interface to Unix. ... ACM is an abbreviation and a TLA that may stand for: Association for Computing Machinery, an association of computing practitioners ACM International Collegiate Programming Contest Academy of Country Music Academic Common Market Academy of Contemporary Music (acm. ... ALGOL 68S was designed as a subset of ALGOL 68 in order to permit single-pass compilation. ...

Report on the Algorithmic Language Algol 68

"Van Wijngaarden once characterized the four authors, somewhat tongue-in-cheek, as: Koster: transputter, Peck: syntaxer, Mailloux: implementer, Van Wijngaarden: party ideologist." -- Koster. Cornelis H.A. Koster is a professor in the Department of Informatics of the University of Nijmegen in the Netherlands. ... Professor Jack E. L. Peck was the first permanent Head of Department of Computer Science at the University of British Columbia. ... Barry J. Mailloux (d. ... Adriaan van Wijngaarden (2 November 1916 - 7 February 1987) was an outstanding computer scientist who is considered by many to have been the founding father of informatica (computer science) in the Netherlands. ...


Revised Report on the Algorithmic Language Algol 68

Edited by: A. van Wijngaarden, B. J. Mailloux, Jack E. L. Peck, C. H. A. Koster, M. Sintzoff, C. H. Lindsey, L. G. L. T. Meertens and R. G. Fisker. Adriaan van Wijngaarden (2 November 1916 - 7 February 1987) was an outstanding computer scientist who is considered by many to have been the founding father of informatica (computer science) in the Netherlands. ... Barry J. Mailloux (d. ... Professor Jack E. L. Peck was the first permanent Head of Department of Computer Science at the University of British Columbia. ... Cornelis H.A. Koster is a professor in the Department of Informatics of the University of Nijmegen in the Netherlands. ...


Notable Language Elements

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, case in ouse in out esac "( ~ | ~ |: ~ | ~ | ~ )", for from to by while do od, if then elif then else fi "( ~ | ~ |: ~ | ~ | ~ )", par begin end "( ~ )", go to, goto, exit. 

Units: Expressions

The basic language construct is the unit. A unit may be a formula, an enclosed clause, a routine text or one of several technically needed constructs (assignation, jump, skip, nihil). The technical term enclosed clause unifies some of the inherently bracketting constructs known as block, do statement, switch statement in other contemporary languages. When keywords are used, generally the reversed character sequence of the introducing keyword is used for terminating the enclosure (if then else fi, case in out esac, for while do od). This feature was reused by Stephen Bourne in the common Unix Bourne shell. An expression may also yield a multiple value, which is constructed from other values by a collateral clause. This construct just looks like the parameter pack of a procedure call. Steve Bourne is a computer scientist, most famous as the author of the Bourne shell (sh), which remains the standard command line interface to Unix. ... Wikibooks has more about this subject: Guide to UNIX Unix or UNIX is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T Bell Labs employees including Ken Thompson, Dennis Ritchie, and Douglas McIlroy. ... The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. ...


mode: Declarations

The basic datatypes (called modes in ALGOL 68 parlance) are real, int, compl (complex number), bool and char. For example: In computer science, a datatype (often simply a type) is a name or label for a set of values and some operations which one can perform on that set of values. ... In mathematics, a complex number is an expression of the form a + bi, where a and b are real numbers, and i stands for the square root of minus one (−1), which cannot be represented by any real number. ...

 int n = 2, m:=3; CO n is a fixed constant of 2, but m is variable which is initially 3 CO real avogadro = 6.0221415₁₀23; CO Avogadro's number CO long long real pi = 3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37510; compl square root of minus one = 0 ⊥ 1; 

However, the declaration real x; is just syntactic sugar for ref real x = loc real;. That is, x is really the constant name for a reference to a newly generated local real variable. Avogadros number, also called Avogadros Constant (NA) is a large constant used in chemistry and physics. ... Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its expressiveness but make it sweeter for humans to use. ...


Furthermore, instead of defining both float and double, or int and long and short, etc., ALGOL 68 provided modifiers, so that the presently common double would be written as long real or long long real instead, for example. Type queries of the kind of max real and min long int are provided to adapt programs to different implementations.


All variables need to be declared, the declaration does not have to appear prior to the first use.


primitive-declarer: int, real, compl, complexG, bool, char, string, bits, bytes, format, file, pipeG, channel, sema

  • bits - a "packed vector" of bool.
  • bytes - a "packed vector" of char.
  • string - a flexible array of char.
  • sema - a semaphore which can be initialised with the operator level.

Other declaration symbols include: flex, heap, loc, ref, long, short, eventS Semaphore can refer to: Semaphore communication by means of flags or other positional indicator. ...

  • flex - declare the array to be flexible, i.e. it can grow in length on demand.
  • heap - allocate variable some free space from the global heap.
  • loc - allocate variable some free space of the local stack.
  • ref - declare the variable to be a pointer, similar to using "&" in a C++ declaration.
  • long - declare an int, real or compl to be of a longer size.
  • short - declare an int, real or compl to be of a shorter size.

A new mode (type) may be declared using a mode declaration:

 int max=99; mode newtype = [0:9][0:max]struct ( long real a, b, c; short int i, j, k; ref real r ); 

This has the similar effect as the following C++ code:

 const int max=99; typedef class { public: double a, b, c; short i, j, k; float &r; } newtype[10][max+1]; 

Note that for ALGOL 68 only the newtype name appears to the left of the equality, and most notably the construction is made - and can be read - from left to right without regard to priorities.


Coercions: casting

The coercions produce a coercend from a coercee according to three criteria: the a priori mode of the coercend before the application of any coercion, the a posteriori mode of the coercee required after those coercions, and the syntactic position or "sort" of the coercee. Coercions may be cascaded.


There are six possible coercions, termed "deproceduring", "dereferencing", "uniting", "widening", "rowing" and "voiding". Each Coercion, except "uniting", prescribes a corresponding dynamic effect on the associated values. Hence, a number of primitive actions can be programmed implicitly by coercions.


Context strength - Allowed coercions:

  • soft - deproceduring
  • weak - dereferencing or deproceduring, yielding a name
  • meek - dereferencing or deproceduring
  • firm - meek, followed by uniting
  • strong - firm, followed by widening, rowing or voiding

prag & co: Code Pragments and Comments

Pragmats are directives in the program, typically hints to the compiler. eg.

 pragmat heap=32 pragmat pr heap=32 pr 

Comments can be inserted in variety of ways:

 ¢ The original way of adding your 2 cents worth to a program ¢ comment "bold" comment comment co Style i comment co # Style ii comment # £ This is a hash/pound comment for a UK keyboard £ 

Normally, comments cannot be nested in ALGOL 68. This restriction can be circumvented by using different comment delimiters (e.g. use hash only for temporary code deletions).


Expressions and compound statements

ALGOL 68 being an expression-oriented programming language, the value returned by an assignment statement is a reference to the destination. Thus, the following is valid ALGOL 68 code: An expression-oriented programming language is one where every construction in the language (except macro definitions, pre-processor commands and, perhaps, declarations), including those that look like statements in other languages, can in principle yield a value and let it be used accordingly. ... In most imperative computer programming languages, the assignment operation is one of the basic operations. ...

 real spi, twice pi; twice pi := 2 * ( spi := 3.1415926 ); 

This notion is present in C and Perl, among others. Note that twice pi is a single identifier, i.e., blanks are permitted within ALGOL 68 names (effectively avoiding the underscores versus camel case versus all lowercase issues at once, but at the price of introducing a cornucopia of more serious problems in software engineering). The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a standardized imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ... Perl, also Practical Extraction and Report Language (a backronym, see below) is an interpreted procedural programming language designed by Larry Wall. ... CamelCase is the practice of writing compound words or phrases where the words are joined without spaces, and each word is capitalized within the compound. ...


As another example, to express the mathematical idea of a sum of f(i) from i=1 to n, the following ALGOL 68 integer expression suffices:

 (int sum := 0; for i to n do sum +:= f(i) od; sum) 

Note that, being an integer expression, the former block of code can be used in any context where an integer value can be used. A block of code returns the value of the last expression it evaluated; this idea is present in Perl, among other languages. Perl, also Practical Extraction and Report Language (a backronym, see below) is an interpreted procedural programming language designed by Larry Wall. ...


Compound statements are all terminated by distinctive (if somewhat irreverent) closing brackets:

  • if choice clauses:
 if condition then statements [ else statements ] fi "brief" form of if statement: ( condition | statements | statements ) if condition1 then statements elif condition2 then [ else statements ] fi "brief" form: ( condition1 | statements :| condition2 | statements | statements ) 
  • case choice clauses:
 case switch in statements, statements,... [ out statements ] esac "brief" form: ( switch | statements,statements,... | statements ) case switch1 in statements, statements,... ouse switch2 in statements, statements,... [ out statements ] esac "brief" form of case statement: ( switch1 | statements,statements,... |: switch2 | statements,statements,... | statements ) 
  • do loop clause:
 [ for index ] [ from first ] [ by increment ] [ to last ] [ while condition ] do statements od The minimum form of a "loop clause" is thus: do statements od 

This scheme not only avoids the dangling else problem but also avoids having to use begin and end in embedded statement sequences. Some actual examples can be found below. The dangling else is a well-known problem in computer programming in which a seemingly well-defined grammar can become ambiguous. ...


struct, union & [:]: Structures, unions and arrays

ALGOL 68 supports arrays with any number of dimensions, and it allows for the slicing of whole or partial rows or columns, among many other choices. In computer programming, an array, also known as a vector or list, is one of the simplest data structures. ...

 mode vector = [3]real; # vector mode declaration (typedef) # mode matrix = [3][3]real; # matrix mode declaration (typedef) # vector r1 := (1,2,3); # array variable initially (1,2,3) # [ ]real r2 = (4,5,6); # constant array, length is implied # op + = (vector a,b)vector: # binary operator definition # (vector out; int i; for i from ⌊a to ⌈a do out[i]:=a[i]+b[i] od; out); matrix m:=(r1,r2,r1+r2); print ((m[ ][2:])); # print the 2nd and 3rd element of each row # 

Matrices can be sliced either way, eg:

 ref vec col:=m[ ][2] # extract a ref (pointer) to the 2nd column!! # 

ALGOL 68 supports multiple field structures (struct). Union types (modes) are supported. Reference variables may point to both array slices and structure fields. For an example of all this, here is the traditional linked list declaration:

 mode node = union (real, int, compl, string); mode list = struct (node val, ref list next); 

Usage example for union case of node:

 node n:="1234"; case n in (real):print(("real:",n)), (int):print(("int:",n)), (compl):print(("compl:",n)), (string):print(("string:",n)) out print ((n,"?")) esac 

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:

 proc max of real = (real a, b) real: (a>b | a | b); 

The return value of a proc is the value of the last expression evaluated in the procedure. References to procedures (ref proc) are also permitted. Call-by-reference parameters are provided by specifying references (such as ref real) in the formal argument list. The following example defines a procedure that applies a function (specified as a parameter) to each element of an array: This article needs to be cleaned up to conform to a higher standard of quality. ...

 proc apply = (ref [] real a, proc (real) real f): for i from lwb a to upb a do a[i] := f(a[i]) od; 

This simplicity of code was unachievable in ALGOL 68's predecessor ALGOL 60. ALGOL (short for ALGOrithmic Language) is a programming language originally developed in the mid 1950s which became the de facto standard way to report algorithms in print for almost the next 30 years. ...


op: Operators

The programmer may define new operators and both those and the pre-defined ones may be overloaded. The following example defines operator max with both dyadic and monadic versions (scanning across the elements of an array). In computer science, polymorphism is the idea of allowing the same code to be used with different classes of data (which classes in typed languages correspond to types), resulting in more general and abstract implementations. ...

 prio max = 9; op max = (int a,b) int: ( a>b | a | b ); op max = (real a,b) real: ( a>b | a | b ); op max = (compl a,b) compl: ( abs a > abs b | a | b ); op max = ([]real a) real: (real out := - max real; for i from lwb a to upb a do ( a[i]>out | out:=a[i] ) od; out); 
  • Monadic Operators:
priority Algol681,2 "Worthy characters[1]" +Algol681 Algol68C,G
10 not, up, down, lwb, upb,

+, -, abs, arg, bin, entier, leng, level, odd, repr, round, shorten

¬, ↑, ↓, ⌊, ⌈ ~
  • Standard dyadic operators with associated priorities:
priority Algol681,2 "Worthy characters" +Algol681 Algol68C,G
9 +*, i +×, ⊥
8 shl, shr, **, up, down, lwb, upb ↑, ↓, ⌊, ⌈
7 *, /, %, over, %*, mod, elem ×, ÷, ÷×, ÷*, %×, ⌷
6 -, +
5 <, lt, <=, le, >=, ge, >, gt ≤, ≥
4 =, eq, /=, ne ~=
3 &, and
2 or
1 minusab, plusab, timesab, divab, overab, modab, plusto,

-:=, +:=, *:=, /:=, %:=, %*:=, +=:

×:=, ÷:=, ÷×:=, ÷*:=, %×:=
priority Algol681,2 "Worthy characters" +Algol681 Algol68C
effectively 0 :=, =:, = , :=:, :/=:, is, isnt :≠: :~=:

Special characters for operators

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. APL (for A Programming Language, or sometimes Array Processing Language) is an array programming language based on a notation invented in 1957 by Kenneth E. Iverson while at Harvard University. ...

APL keyboard with special characters
APL keyboard with special characters

This work is copyrighted, and used with permission. ...

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[i] 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:

  • Books 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 mood 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 event routines. 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

"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 semaphores. 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). Semaphore can refer to: Semaphore communication by means of flags or other positional indicator. ... In computing, an operating system (OS) is the system software responsible for the direct control and management of hardware and basic system operations. ...

 mode foot = [5]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 ) 

The Colt Python is a . ...

Code sample

This sample program implements the Sieve of Eratosthenes to find all the prime numbers 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. In mathematics, the Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer. ... In mathematics, a prime number (or prime) is a natural number greater than one whose only positive divisors are one and itself. ...

 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: (proc f = (int m,n) list: (m>n | nil | cons(m, f(m+1,n))); f(1,n)); mode list = ref node; mode node = struct (int h, list t); proc cons = (int n, list l) list: heap node := (n,l); proc hd = (list l) int: ( l is nil | error("hd nil"); skip | h of l ); proc tl = (list l) list: ( l is nil | error("tl nil"); skip | t of l ); proc show = (list l) void: ( l isnt nil | print((" ",whole(hd(l),0))); show(tl(l))); proc filter = (proc (int) bool p, list l) list: if l is nil then nil elif p(hd(l)) then cons(hd(l), filter(p,tl(l))) else filter(p, tl(l)) fi; proc sieve = (list l) list: if l is nil then nil else proc not multiple = (int n) bool: n mod hd(l) ≠ 0; cons(hd(l), sieve( filter( not multiple, tl(l) ))) fi; proc primes = (int n) list: sieve( tl( one to(n) )); show( primes(100) ) end 

Program representation

A feature of ALGOL 68, inherited from ALGOL tradition, is its different representations. There is a representation language used to describe algorithms in printed work, a strict language (rigorously defined in the Report) and an official reference language intended to be used in actual compiler input. In the examples above you will observe underlined words. This is the formal representation of the language. ALGOL 68's reserved words are effectively in a different namespace from identifiers, and spaces are allowed in identifiers, so the fragment: ALGOL (short for ALGOrithmic Language) is a family of imperative computer programming languages originally developed in the mid 1950s which became the de facto standard way to report algorithms in print for almost the next 30 years. ... Many modern computer languages provide support for namespaces. ...

 int a real int = 3 ; 

is legal. The programmer who actually writes the code does not have the option of underlining the code. Depending on hardware and cultural issues, different methods to denote these identifiers, have been devised, called stropping regimes. So all or some of the following may be possible programming representations:

 'INT' A REAL INT = 3; .INT A REAL INT = 3; INT a real int = 3; int a_real_int = 3; 

The following characters were recommended for portability, and termed "worthy characters" in the Report on the Standard Hardware Representation of Algol 68:

  • ^ Worthy Characters: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "#$%'()*+,-./:;<=>@[ ]_|

This reflected a problem in the 1960s where some hardware didn't support lowercase, nor some other non ASCII characters, indeed in the 1973 report it was written: "Four worthy characters -- "|", "_", "[", and "]" -- are often coded differently, even at installations which nominally use the same character set." There are 95 printable ASCII characters, numbered 32 to 126. ...

  • Base characters: "Worthy characters" are a subset of "base characters".

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 no mode, empty - the only value admissible to void, needed for selecting void in a union, [1:0]int - 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, 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. Java is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s. ...


Comparison to C++

Regarding the computing features, the nearest living sibling to ALGOL 68 may be C++, making this a good comparison candidate: C++ (pronounced see plus plus, IPA: /siː pləs pləs/) is a general-purpose computer programming language. ...


C++ has not:

  • nested functions,
  • definable operator symbols and priorities,
  • garbage collection,
  • use before define,
  • formatted transput using complex formatting declarations,
  • assignment operation symbol (to avoid confusion with equal sign),
  • arrays (and slice operations on them, but in layered libraries),
  • automatic UNIONs,
  • CASE expressions,
  • nonlocal GOTO (not a good idea in most cases, anyway).
  • intuitive declaration syntax due to its origin from C.

ALGOL 68 has not: The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a standardized imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ...

  • public/private access protection,
  • overloaded procedures (in contrast to operators),
  • explicit memory allocation and deallocation,
  • forward declarations,
  • textual preprocessing (header files),
  • confusion between &- and pointer-style,
  • comment lines (only bracketed comments),
  • hierarchical classes.

Variants

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


The language of the unrevised Report

The original language(1) 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

 op andf = (boola,proc boolb)bool:(a | b | false); 

b is only evaluated, if a is true. As defined in ALGOL 68, it did not work as expected. Most implementations emulate the correct behaviour for this special case by extension of the language.


Before revision, the programmer could decide to have the arguments of a procedure evaluated serially instead of collaterally by using semicolons instead of commas (gommas).


Extension proposals from IFIP WG 2.1

After the revision of the report, some extensions to the language have been proposed to widen the applicability:

  • partial parametrisation: creation of functions (with less parameters) by specification of some, but not all parameters for a call, e.g. a function logarithm of two parameters, base and argument, could be specialised to natural, binary or decadic log,
  • module extension for support of external linkage,
  • mode parameters for implementation of limited parametrical polymorphism (most operation on data structures like lists, trees or other data containers can be specified without touching the pay load).

So far, only partial parametrisation has been implemented, in ALGOL68G.


True ALGOL 68s Specification and Implementation Timeline

Name Year Purpose State Description Target CPU Licencing
Generalized_ALGOL 1962 Scientific NL ALGOL for generalised grammars
ALGOL Y0 1966 Scientific Intl First version of Algol 68 Specification ACM
ALGOL 681 1968 Scientific Intl IFIP WG 2.1 Final Report Specification ACM
ALGOL 68-RR 1970 Scientific UK ICL, Multics, VMS & C generator Open Source
EPOS ALGOLE 1971 Scientific
ALGOL 68RSRS 1972 Scientific UK Extended RS Algol
Algol 68 with areasA 1972 Experimental & other UK Addition of areas to Algol 68
OREGANO 1973 Research US "The importance of implementation models." UCLA
ALGOL 68CC 1975 Scientific UK Cambridge Algol 68 ICL, IBM 360, PDP 10 & Unix
ALGOL 68 Revised2 1975 Scientific Intl IFIP WG 2.1 Revised Report Specification ACM
Algol HH 1975 Experimental & other UK Proposed extensions to the mode system of Algol 68 Specification
Algol 68 ORDAo 1976 practical uses USSR ODRA 1204/IL
ALGOL 68SS 1977 Scientific Intl Simplified version of ALGOL 68 Amiga & Sun Sparc
FLACCF 1977 Multi-purpose CA Mailloux's Algol 68
ALGOL 68-RTRT 1979 Scientific UK Parallel ALGOL 68-R
RS Algolrs 1979 Scientific UK
ALGOL 68++ 1980 Scientific NL Superlanguage of ALGOL 68
ALGOL 68 LGUL 1980 Telecommuni- cations USSR Full Language + Modules IBM, DEC, CAMCOH, PS 1001 & PC
ALGOL 68GG 2001 Full Language NL Includes standard collateral clause Interpreter in C GPL


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 Y was the name given to a speculated successor for the ALGOL 60 programming language that incorporated some radical features that were rejected for ALGOL 68. ... ACM is an abbreviation and a TLA that may stand for: Association for Computing Machinery, an association of computing practitioners ACM International Collegiate Programming Contest Academy of Country Music Academic Common Market Academy of Contemporary Music (acm. ... ACM is an abbreviation and a TLA that may stand for: Association for Computing Machinery, an association of computing practitioners ACM International Collegiate Programming Contest Academy of Country Music Academic Common Market Academy of Contemporary Music (acm. ... The University of California, Los Angeles, popularly known as UCLA, is a public, coeducational university situated in the neighborhood of Westwood within the city of Los Angeles. ... The ALGOL68C computer programming language compiler was developed for the CHAOS OS for the CAP capability computer at Cambridge University in 1971 by Stephen Bourne and Mike Guy as a dialect of ALGOL 68. ... ACM is an abbreviation and a TLA that may stand for: Association for Computing Machinery, an association of computing practitioners ACM International Collegiate Programming Contest Academy of Country Music Academic Common Market Academy of Contemporary Music (acm. ... ALGOL 68S was designed as a subset of ALGOL 68 in order to permit single-pass compilation. ... Algol 68 Genie (Algol68G) is an Algol 68 interpreter. ... The GNU logo For other uses of GPL, see GPL (disambiguation). ... This article is about the operating system. ... The ICL 2900 Series was a range of mainframe computer systems announced by the UK manufacturer ICL on 9 October 1974. ...


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. This article needs cleanup. ... International Computers Ltd, or ICL, was a large British computer hardware company that operated from 1968 until 2002, when it was renamed Fujitsu Services Limited after its parent company, Fujitsu. ... Computer science - Wikipedia, the free encyclopedia /**/ @import /skins-1. ...


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, 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. The Royal Signals and Radar Establishment was a scientific research establishment within the Ministry of Defences Defence Procurement Agency of the United Kingdom, located primarily at Malvern in Worcestershire. ... International Computers Ltd, or ICL, was a large British computer hardware company that operated from 1968 until 2002, when it was renamed Fujitsu Services Limited after its parent company, Fujitsu. ... Multics (Multiplexed Information and Computing Service) was an extraordinarily influential early time-sharing operating system. ... VAX is a 32-bit computing architecture that supports an orthogonal instruction set (machine language) and virtual addressing (i. ...


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. Carnegie Mellon University Carnegie Mellon University is a private research university located in Pittsburgh, Pennsylvania. ... The C.mmp was an early multiprocessor system developed at Carnegie_Mellon_University by W.A.Wulf (1971). ...


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. The University of Cambridge is the second-oldest university in the English-speaking world, with one of the most selective sets of entry requirements in the United Kingdom. ... The ALGOL68C computer programming language compiler was developed for the CHAOS OS for the CAP capability computer at Cambridge University in 1971 by Stephen Bourne and Mike Guy as a dialect of ALGOL 68. ...


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. Algol 68 Genie (Algol68G) is an Algol 68 interpreter. ...


"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."[2]


Quotes

  • [...] it was said that A68's popularity was inversely proportional to [...] the distance from Amsterdam [3]
  • ... 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 [4]
  • "Congratulations, your Master has done it" - Niklaus Wirth, Aug 1968.
  • '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." ' - C. A. R. Hoare, Oct 1980, re: "Dec 1968"

Ken Thompson (left) with Dennis Ritchie (right) Dennis MacAlistair Ritchie (September 9, 1941) is a computer scientist notable for his influence on ALTRAN, B, BCPL, C, Multics, and Unix. ... Niklaus Wirth giving a lecture Niklaus E. Wirth (born February 15, 1934) is a Swiss computer scientist. ...

References

  • 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 8, 155-190, June 1976 and 9, 255-256, September 1977, http://vestein.arb-phys.uni-dortmund.de/~wb/RR/tanenbaum.pdf

External links


  Results from FactBites:
 
ALGOL - Wikipedia, the free encyclopedia (911 words)
ALGOL (short for ALGOrithmic Language) is a family of imperative computer programming languages originally developed in the mid 1950s which became the de facto standard way to report algorithms in print for almost the next 30 years.
Algol-W was intended to be the next generation ALGOL, but the majority of the ALGOL 68 committee decided to design a language that was more complex and advanced rather than a language that is basically a cleaned up version of ALGOL 60.
ALGOL 68 was defined using a two-level grammar formalism invented by Adriaan van Wijngaarden and which bears his name.
Algol 68 - definition of Algol 68 in Encyclopedia (1892 words)
ALGOL 68 was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and a more rigorously defined syntax and semantics.
Long under-recognized (probably due to its mainly European origin), the contributions of ALGOL 68 to the whole field of computer science are deep and wide ranging, although many of them were not publicly identified until they were passed, in one form or another, to many subsequently developed programming languages.
ALGOL 68 being an expression-oriented programming language, the value returned by an assignment statement is a reference to the destination.
  More results at FactBites »

 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your location
Your comments
Please enter the 5-letter protection code


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.