A brief look at the utter madness of Algol 68

People complain about old languages, usually before they even take a deeper look at them. Sure, some are “interesting”, to say the least. Go and read one of the language definitions from the 1960s, they are real eye-openers. Some of the language is quite interesting. Take Algol 68 for instance. Here’s a simple piece of code to calculate Fibonacci numbers:

COMMENT
Algol 68 program to calculate the Sieve of Eratosthenes
for some upper limit N
COMMENT

PROC eratosthenes = (INT n) []INT:
(
    [n]INT sieve;

    FOR i TO UPB sieve DO
        sieve[i] := i
    OD;
    INT k = ENTIER sqrt(n);
    sieve[1] := 0;
    FOR i FROM 2 TO k DO
        IF sieve[i] NE 0 THEN
            FOR j FROM i*i BY i TO n DO
                sieve[j] := 0
            OD
        FI
    OD;
    sieve
);

INT n;
print("Upper limit to calculate sieve? ");
read(n);
print((eratosthenes(n), newline))

If you are only use to looking at C-like code, this might look somewhat obscure, and it does get worse. But to programmers of the time, it probably seemed quite fine. Maybe we have become too complacent.

Advertisements

One thought on “A brief look at the utter madness of Algol 68

  1. codeinfig says:

    you can still find some of this in bash scripting: (basic and python were both inspired by algol, as im sure you know already) …and check out that pascal-style assignment syntax!

    k=20
    for i in $(seq 2 $k) ; do echo $i
    
      if [[ $i -gt 10 ]]
        then echo "yes"
        fi
    
      done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s