Home
  • Products
  • Solutions
  • Support
  • Company
  • Products
  • Solutions
  • Support
  • Company
Community Breakfast Bytes Old Programming Languages

Author

Paul McLellan
Paul McLellan

Community Member

Blog Activity
Options
  • Subscriptions

    Never miss a story from Breakfast Bytes. Subscribe for in-depth analysis and articles.

    Subscribe by email
  • More
  • Cancel
offtopic

Old Programming Languages

17 Nov 2022 • 11 minute read

 breakfast bytes logocadencelive europeThis is the last day before a break. Tomorrow I fly to Germany for CadenceLIVE Europe, and I will be taking a week of vacation after that to visit Berlin, a city I've somehow never visited. Breakfast Bytes will next appear on November 30th. As usual, I go offtopic the last day before a break, although today is not very offtopic. I thought I'd write about the programming languages that I have used over the years. In the past, I feel there were more programming languages than there are today. I'm sure you've heard of C and almost certainly used it if you are a programmer. But the way C came into existence was typical for the era. Denis Ritchie and Ken Thompson had a computer (a PDP-7 initially, then a PDP-11) but no programming language or compiler. So they invented a programming language, wrote the compiler, and then wrote what has to be the most influential operating system ever, Unix. You can read more about Unix in my post, The Most Important Operating System Ever.

Many universities and academic groups did something similar, ending up with a local idiosyncratic language for which they had written their own compilers.

City and Guilds

I learned to program in the late 1960s. The first language I learned was something called City and Guilds Mnemonic Code. This was a pseudo-assembly language for teaching people how to program in assembly language without them having to have exclusive access to the hardware (an ICL 1904). In the unlikely event that you want to know more about it, there is still a page with all the details dating back to the 60s and 70s when it was used as part of a computer literacy project. It looked something like this:

LDA n,m
ADD n,m
JEQ n,m

Fortran

mccracken fortran ivThe next language I learned was Fortran IV. This was one of two languages created in the late 1950s, the other being Cobol. Fortran stood for "formal translation" and Cobol for "common business-oriented language." The expectation was that scientists would do their mathematical work in Fortran, which partially happened, and that businesspeople would write their own Cobol programs that certainly did not. When I had my first professional job (well, I was being paid, I'd not studied computer science at that point, so I don't think it was professional in other ways), I used Fortran since it was the only language apart from assembly code on the computer we were using. Fortran still exists today and is widely used for scientific work, including all the benchmarks for supercomputers. Here's an example of a very old version of Fortran. This is not correctly formatted because that's too complicated. In Fortran the first 5 columns are for labels (like 501 on the 3rd line), the 6th column indicates that the line is a continuation of the line(s) before, and the actual code started in column 7. And columns 72-80 were sequence numbers since it was designed to be put on punched cards in that era.

C AREA OF A TRIANGLE - HERON'S FORMULA
READ(5,501) IA,IB,IC
501 FORMAT(3I5)
IF (IA) 701, 777, 701
701 IF (IB) 702, 777, 702
702 IF (IC) 703, 777, 703
777 STOP 1
703 S = (IA + IB + IC) / 2.0
AREA = SQRT( S * (S - IA) * (S - IB) * (S - IC) )
WRITE(6,801) IA,IB,IC,AREA
801 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,$13H SQUARE UNITS)
STOP
END

Algol-W

When I studied computer science at Cambridge University, the first language we were taught as the language for general work on programming and algorithms was Algol-W. I believe that the "W" stands for Wirth, who is Niklaus Wirth. It was an upgrade of Algol-60 with strings, records, and a few more features. It turned out to be a very easy language to learn (remember, many of the people studying computer science had never programmed before, so a language that was hard to learn wouldn't fit with a one-year computer science course).

Here's an example:

REFERENCE(PERSON) PROCEDURE YOUNGESTUNCLE (REFERENCE(PERSON) R);
BEGIN
REFERENCE(PERSON) P, M;
P := YOUNGESTOFFSPRING(FATHER(FATHER(R)));
WHILE (P ¬= NULL) AND (¬ MALE(P)) OR (P = FATHER(R)) DO
P := ELDERSIBLING(P);
M := YOUNGESTOFFSPRING(MOTHER(MOTHER(R)));
WHILE (M ¬= NULL) AND (¬ MALE(M)) DO
M := ELDERSIBLING(M);
IF P = NULL THEN
M
ELSE IF M = NULL THEN
P
ELSE
IF AGE(P) < AGE(M) THEN P ELSE M
END

Algol68

algol68 reportThe next language was somewhat weird. It had the most complex language specification of any language ever, in a very formal and rigid specification. As a result, there were very few compilers (although there was one at Cambridge). It was a language that seemed to have every feature possible thrown into it, and every variety of syntax possible. This made it, unlike Algol-W, very hard to learn, and it had very few applications outside of education and not much else there. You won't be surprised to learn that it was designed by a committee, the International Federation for Information Processing IFIP Working Group 2.1 on Algorithmic Languages and Calculi. Here's an example:

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

BCPL

In contrast to Algol-68, the language was designed by one person, Martin Richards. Very conveniently, he not only wrote the first compilers, he was our lecturer on compilers, and we had access to the full source code of the compiler. The language was small enough that it was possible to find your way around the whole compiler. Reading industrial-scale programs is a great way to learn compared to writing toy programs. BCPL actually stood for Basic Combined Programming Language. It was the main language that we used as computer scientists at Cambridge once we outgrew Algol-W. It didn't really have types, just single 32-bit words. A derivative of BCPL was the B programming language (I think named by removing the CPL bit), and B became the C programming language (being the next letter). I don't think teletypes of that era had curly brackets, so despite being what are often called "curly bracket languages," its brackets were actually $( and $). Here's what it looked like:

GET "LIBHDR"

GLOBAL $(
COUNT: 200
ALL: 201
$)

LET TRY(LD, ROW, RD) BE
TEST ROW = ALL THEN
COUNT := COUNT + 1
ELSE $(
LET POSS = ALL & ~(LD | ROW | RD)
UNTIL POSS = 0 DO $(
LET P = POSS & -POSS
POSS := POSS - P
TRY(LD + P << 1, ROW + P, RD + P >> 1)
$)
$)

LET START() = VALOF $(
ALL := 1
FOR I = 1 TO 12 DO $(
COUNT := 0
TRY(0, 0, 0)
WRITEF("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)
ALL := 2 * ALL + 1
$)
RESULTIS 0
$)

Imp

I think of Imp as being the Edinburgh equivalent of BCPL, the main language used for all system programming, compilers, and even the language we taught everyone in first-year computer science. The language is sometimes called "Edinburgh Imp" since there was another programming language called Imp developed by the NSA. Keywords all started with a % sign, giving it a distinctive look.

%begin

%integer A, B, SUM, DIFFERENCE, MAX, MIN

MAX = -1; MIN = 5000

%cycle
READ(A)
%exit %if A=-1; ! End of input.
READ(B)
PRINTSTRING("Input values:")
WRITE(A,3); PRINTSYMBOL(',')
WRITE(B,3)
SUM = A+B; DIFFERENCE = A-B
PRINTSTRING(" ... Sum is")
WRITE(SUM,3)
PRINTSTRING(", Difference is")
WRITE(DIFFERENCE,3); NEWLINE
%if SUM>MAX %start
MAX = SUM
%finish %else %if SUM<MIN %start
MIN = SUM
%finish
%repeat
NEWLINE
PRINTSTRING("Maximum sum is")
WRITE(MAX,3); NEWLINE
PRINTSTRING("Minimum sum is")
WRITE(MIN,3); NEWLINE

%end %of %program

Pascal

pascal manualWhen we decided to offer a Masters in Computer Engineering at Edinburgh, we decided for reasons I forget to use Pascal, not Imp. One of my jobs was to teach the one-week introductory Pascal course for people who had never programmed, which took place in the week before the start of term. I found this really difficult for two reasons. Firstly, I'd forgotten what was difficult about programming after doing it for so long. But the second was that I'd never programmed in Pascal, so I had to learn it, which I did by doing the end-of-year project myself. It was designed as an instructional language, so it was easy to learn. The language was created by Niklaus Wirth, who came near the beginning of this post with Algol-W.

(*****************************************************************************
* A simple bubble sort program. Reads integers, one per line, and prints *
* them out in sorted order. Blows up if there are more than 49. *
*****************************************************************************)
PROGRAM Sort(input, output);
CONST
(* Max array size. *)
MaxElts = 50;
TYPE
(* Type of the element array. *)
IntArrType = ARRAY [1..MaxElts] OF Integer;

VAR
(* Indexes, exchange temp, array size. *)
i, j, tmp, size: integer;

(* Array of ints *)
arr: IntArrType;

(* Read in the integers. *)
PROCEDURE ReadArr(VAR size: Integer; VAR a: IntArrType);
BEGIN
size := 1;
WHILE NOT eof DO BEGIN
readln(a[size]);
IF NOT eof THEN
size := size + 1
END
END;

BEGIN
(* Read *)
ReadArr(size, arr);

(* Sort using bubble sort. *)
FOR i := size - 1 DOWNTO 1 DO
FOR j := 1 TO i DO
IF arr[j] > arr[j + 1] THEN BEGIN
tmp := arr[j];
arr[j] := arr[j + 1];
arr[j + 1] := tmp;
END;

(* Print. *)
FOR i := 1 TO size DO
writeln(arr[i])
END.

Mainsail

mainsail manualVLSI Technology decided to use Mainsail for creating its EDA tools, which stood for machine-independent Stanford artificial intelligence language. Interestingly, Tangent made the same decision, so for years, a lot of Cadence's place and route system was written in Mainsail too. There were other EDA users. I think Hewlett-Packard used it internally. It was the first object-oriented language I'd used, although it didn't have full inheritance. I have probably written more lines of Mainsail than any other language since I did little but write code for EDA tools for 6 or 7 years. Here's "hello world" in Mainsail, which seems to be the only code I can find with Google (not least because you get a lot of stuff about sailing!)

BEGIN "simple"
INITIAL PROCEDURE;
BEGIN
write (logFile, "Hello, world." & eol);
END;
END "simple"

Mainstream Languages

I have also programmed in a few mainstream languages such as C, C++, Python. But everyone knows those. There are other languages such as Go (developed by Google) and Rust that seem to have some traction for industrial strength programming at scale. But I've not written any code for years...just blog posts.

 

Sign up for Sunday Brunch, the weekly Breakfast Bytes email.

.


© 2023 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information