Cambridge ALGOL 68C: Difference between revisions

From Rosetta Code
Content added Content deleted
m (foundation page, from wikipedia)
 
m (→‎External links: New link)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{implementation|ALGOL 68}}{{stub}}
{{implementation|ALGOL 68}}
===The <code>ENVIRON</code> and <code>USING</code> clauses.===
===The <tt>ENVIRON</tt> and <tt>USING</tt> clauses.===
These clauses are kind of the ''inverse'' of the '''#include''' found in the C (programming language)|C programming language, or '''import''' found in Python (programming language)|Python. The purpose of the <code>ENVIRON</code> 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)|C programming language where the include file needs to be parsed for each source file that includes it.
These clauses are kind of the ''inverse'' of the '''#include''' found in the [[C|C programming language]], or '''import''' found in [[Python]]. The purpose of the <tt>ENVIRON</tt> 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 <code>ENVIRON</code> clause ====
==== Example of <tt>ENVIRON</tt> clause ====
A file called ''mylib.a68'':
A file called ''mylib.a68'':
<pre>
<pre>
Line 15: Line 15:
END
END
</pre>
</pre>
==== Example of <code>USING</code> clause ====
==== Example of <tt>USING</tt> clause ====
A file called ''usemylib.a68'':
A file called ''usemylib.a68'':
<pre>
<pre>
Line 30: Line 30:
== Restrictions to the language from the standard '''ALGOL 68''' ==
== Restrictions to the language from the standard '''ALGOL 68''' ==
* no algol68 FLEX and variable length arrays.
* no algol68 FLEX and variable length arrays.
* <code>MODE STRING</code> implemented without FLEX.
* <tt>MODE STRING</tt> implemented without FLEX.
* The PAR parallel clause was not implemented.
* The PAR parallel clause was not implemented.
* nonstandard transput.
* nonstandard transput.
Line 40: Line 40:
* [http://hopl.murdoch.edu.au/showlanguage.prx?exp=667 Cambridge Algol 68: on the historical roster of computer languages] - includes 10+ publication references.
* [http://hopl.murdoch.edu.au/showlanguage.prx?exp=667 Cambridge Algol 68: on the historical roster of computer languages] - includes 10+ publication references.
* [http://portal.acm.org/ft_gateway.cfm?id=807148&type=pdf A TRANSPORTATION OF ALGOL68C - PJ Gardner, University of Essex] - March 1977 (From 370 to DECsystem-10)
* [http://portal.acm.org/ft_gateway.cfm?id=807148&type=pdf A TRANSPORTATION OF ALGOL68C - PJ Gardner, University of Essex] - March 1977 (From 370 to DECsystem-10)
* [https://jmvdveer.home.xs4all.nl/en.post.algol-68-mvs.html Running Algol68C on MVS] - using an emulator

Latest revision as of 10:52, 30 January 2022

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:

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

Example of USING clause

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 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