|This article needs additional citations for verification. (August 2012)|
|Developer(s)||Stephen Bourne, Michael Guy, Andrew D. Birrell, Ian Walker, Chris Cheney et al.|
|Initial release||c. 1970|
|Stable release||1.3039 / March 3, 2013|
|Written in||ALGOL 68|
|Operating system||IBM 360/370/etc mainframes (or their emulations) running MVT or MVS|
The language was originally called Z70 and was subsequently morphed into ALGOL 68. ALGOL68C was initially built to develop and program the CAMbridge ALgebra system called CAMAL. The initial compiler was written in PSYCO (the Princeton SYntax COmpiler by Edgar T. Irons) that was implemented by J.H. Mathewman at Cambridge. The compiler and language were initially developed by Stephen Bourne and Michael Guy as a dialect of ALGOL 68.
The ALGOL68C compiler generated ZCODE output, that could then be either compiled into the local machine code by a ZCODE translator or run interpreted. ZCODE is a register-based intermediate language. This ability to interpret or compile ZCODE encouraged the porting of ALGOL 68C to numerous different computer platforms. Aside from the CAP capability computer the compiler was ported to systems including CMS, TOPS-10 and Z80.
A very early predecessor of this compiler was used by Guy and Bourne to write the first life game programs on the PDP-7 with a DEC 340 display (see Scientific American article) "For long-lived populations such as this one Conway sometimes uses a PDP-7 computer with a screen on which he can observe the changes; The program was written by M. J. T. Guy and S. R. Bourne. Without its help some discoveries about the game would have been difficult to make." Scientific American 223 (October 1970): 120-123.
Various Liverpool Software Gazette issues detail the Z80 implementation. The compiler required about 120Kb of memory to run, hence the Z80's 64Kb memory is actually too small to run the compiler. So ALGOL 68C programs for the Z80 had to be cross compiled from ALGOL 68C running on the larger CAP capability computer or an IBM System/370 mainframe.
Algol 68C and Unix
Stephen Bourne subsequently reused ALGOL 68's
if ~ then ~ else ~ fi,
case ~ in ~ out ~ esac and
for ~ while ~ do ~ od clauses in the common Unix Bourne shell, but with
in's syntax changed,
out removed, and
od replaced with
done (to avoid conflict with the od utility).
After Cambridge, Bourne spent nine years at Bell Labs with the Seventh Edition Unix team. As well as developing the Bourne shell, he ported ALGOL 68C to Unix on the DEC PDP-11-45 and included a special option in his Unix debugger "adb" to obtain a stack backtrace for programs written in ALGOL68C. Here is an extract from the Unix 7th edition adb manual pages:
NAME adb - debugger SYNOPSIS adb [-w] [ objfil [ corfil ] ] [...] COMMANDS [...] $modifier Miscellaneous commands. The available modifiers are: [...] a ALGOL 68 stack backtrace. If address is given then it is taken to be the address of the current frame (instead of r4). If count is given then only the first count frames are printed.
ALGOL 68C extensions to Algol 68
Below is a sampling of some notable extensions:
- Automatic op:= for any operator, e.g.
- displacement operator (
- separate compilation -
- scopes not checked
- bounds in formal-declarers
EDOCclause - for embedding ZCODE
Separate compilation in ALGOL 68C is done using the
USING clauses. The
ENVIRON saves the complete environment at the point it appears. A separate module written starting with a
USING clause is effectively inserted into the first module at the point the
ENVIRON clause appears.
USING are useful for a top-down style of programming, in contrast to the bottom-up style implied by traditional library mechanisms.
These clauses are kind of the inverse of the #include found in the C programming language, or import found in Python. The purpose of the
ENVIRON mechanism is to allow a program source to be broken into manageable sized pieces. Note that it is only necessary to parse the shared source file once, unlike a #include found in the C programming language where the include file needs to be parsed for each source file that includes it.
A file called mylib.a68:
BEGIN INT dim = 3; # a constant # INT a number := 120; # a variable # ENVIRON EXAMPLE1; MODE MATRIX = [dim, dim]REAL; # a type definition # MATRIX m1; a number := ENVIRON EXAMPLE2; print((a number)) END
A file called usemylib.a68:
USING EXAMPLE2 FROM "mylib" BEGIN MATRIX m2; # example only # print((a number)); # declared in mylib.a68 # print((2 UPB m1)); # also declared in mylib.a68 # ENVIRON EXAMPLE3; # ENVIRONs can be nested # 666 END
Restrictions to the language from the standard ALGOL 68
- no algol68 FLEX and variable length arrays.
MODE STRINGimplemented without FLEX.
- The PAR parallel clause was not implemented.
- nonstandard transput.
- S.R. Bourne, A.D. Birrell and I. Walker, Algol68C reference manual, Cambridge University Computer Laboratory, 1975
- Cambridge Algol 68: on the historical roster of computer languages - includes 10+ publication references.
- A TRANSPORTATION OF ALGOL68C - PJ Gardner, University of Essex - March 1977 (From 370 to DECsystem-10)
- Running Algol68C on MVS - how to install Algol68C on an emulated MVS system