Cambridge ALGOL 68C

From Rosetta Code
(Redirected from Category:ALGOL 68C)
Cambridge ALGOL 68C is an implementation of ALGOL 68. Other implementations of ALGOL 68.

The ENVIRON and USING clauses.

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.

Example of ENVIRON clause

A file called mylib.a68:

   INT dim = 3; # a constant #
   INT a number := 120; # a variable #
   MODE MATRIX = [dim, dim]REAL; # a type definition #
   MATRIX m1;
   a number := ENVIRON EXAMPLE2;
   print((a number))

Example of USING clause

A file called usemylib.a68:

  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 #

Restrictions to the language from the standard ALGOL 68

  • no algol68 FLEX and variable length arrays.
  • MODE STRING implemented without FLEX.
  • The PAR parallel clause was not implemented.
  • nonstandard transput.
  • others...

A translator/compiler for ALGOL 68C was available for the PDP-10 and System/360 as well as a number of other computers.

External links