Computer Languages

John O’Gorman

13 April 2017

1 Intro

This aims at being a once over lightly of computer languages past and present. The original document was lost and is being rewritten. It reflects my personal involvement in computing from the 1980s to today.

2 Assembly

In the beginning was the CPU (Central Processing Unit) the heart of the computer with its very limited instruction set. It included commands to load and store values to and from memory, load and store values to and from registers (high speed bits within the CPU), some logic operations: AND, OR, NOT, NAND, NOR , some arithmentic operations ADD, Negate and very little else. To achieve other arithmetic operations e.g. minus you negate the 2nd operand and ADD, to multiply you repeatedly ADD, to divide you NEGATE then repeatedly ADD.
Each CPU had a different set of operations depending on the architecture that manufacturer e.g. Intel, RCA, Motorola, IBM had designed. To do anything worthwhile, you had to have dozens or more likely hundreds of commands e.g. to let c=3+4 you would code something like:
load a, 3
add a, 4
store a, c
This would load register a with the value 3, add 4 to the contents of register a, then store the value of register a into our memory address c.
The first CPU that I met was the Motorola 6809 which came with a SWTPC (South West Technical Products Computer) running an 8-bit Unix-like Operating System called Uniflex supplied to Sacred Heart College by Ike Zimmerman. I learnt the rudiments of Assembly Language Programming from seeing the source code of Mark Lochore who worked with Mike Zimmerman. The 6809 had new features: 5 16-bit registers labeled X and Y index registers, U and S stack pointers, a PC (program counter register), and 2 8-bit accumulators A and B which could be combined as D to hold 16-bit values.

3 High Level Languages

Because each manufacturer produced a different instruction set, you could only run your programs on the brand of CPU you had programmed for. This restriction irked programmers who had to rewrite their code, test it, and debug it for each manufacturer.
To overcome this limitation programmers designed higher level languages which provided a standard set of operations and expressions and then translated them into the appropriate assembly language for the target CPU.
The translator programs came in 2 classes:
High level languages have several types of statement in common: assignment, conditions, iterations, compounds.

4 Unix Shells

From its inception in 1970, UNIX provided an interpreter called a shell. The concept was of a nut - the heart of the nut was the kernel which executed instructions, the shell was the outer layer which passed commands to the kernel (protecting it from mortal users). The user typed in commands which were interpreted by the shell and executed immediately.
It became customary for language designers and writers to provide the Hello World! program for each language. For the shell is was
echo “Hello World!”
The original shell was written by Stephen Bourne and its name was sh. Later the Korn shell added features such as history of commands. Later again came the Bourne Again shell (bash) written by the Brian Fox as part of the GNU (Gnu is Not Unix) project and released in 1989 as a free sh compatible shell for Linux and Mac OSX.
Belatedly I came to understand the full power of ksh and bash a long time after I had acquired the habit of solving all computer problems with a C code program. I now attack any problems using bash scripts and if necessary use perl or python if appropriate.

5 Forth

The 1st high level language that I met in the early 1980s was Forth. Forth was a stack language designed and implemented by Charles “Chuck” Moore. It was in concept close to the design of a CPU.
Its Hello world program was CR .( Hello World! )
Forth had 2 stacks (First in, last out structures) one for function calls, the other for the user’s arithmetic. e.g.
17 7 * 47 + CR .
will push 17 onto the stack, push 7 onto the stack, multiply the 2 top values on the stack replacing them with the product, then push 47 onto the stack, then Output on a new line the value on the stack (removing it). In modern languages this would be expressed as 17 * 7 + 47 This sort of thing is called Reverse Polish and was the way of early calculators during the 1980s.
Forth was common in the early years of microcomputers where it required very little storage and functioned as a shell and a programming language. It was used in embedded systems controlling heavy machinery especially in the aero and space industries. Boeing used a Forth controlled machine for pressing out the wings of aircraft.

5.1 Hello World

CR .(Hello World!)

6 Postscript

Postscript designed at Adobe Systems was like Forth also a stack language but aimed at controlling output for printers. A postscript printer was in effect a computer with the possible side-effect of outputing documents on a printer. It was possible to access the printer from a computer using a terminal and entering postscript commands and having the printer execute them. Postscript has lost its importance since the 1980s due to the cost of licensing it from Adobe relative to the hugely reduced cost of printers. Nowadays most printers use the PDF language.


PDF (Portable Data Format) is a subset of postscript is freely available and you expect any printer to accept PDF documents and print them appropriately.

8 LisP

Very early on in the history of computing, John McCarthy invented the LisP (List Processor) language in 1958. (The only older computer language is Fortran). LisP has become the staple of the American Artificial Intelligence Community. ( Europeans favour Prolog for AI). In LisP everything is in parenthesised lists: e.g. 4+5 is expressed as (PLUS 4 5)
LisP is the underlying program for the editor emacs. Having LisP available allowed knowledgible programmers to effectively reprogram emacs and add commands and environments appropriate for the languages they were coding in. Keywords for manipulating lists are LisP CONS, CAR, CDR where CONS constructs a list, CAR returns the 1st element of a list, CDR returns the tail of a list (having removed the CAR element).

8.1 Hello World!

The following code defines a function hello which when called displays the quoted string:
(DEFUN HELLO () “Hello World!” )              

9 Pascal

Pascal was designed by Niklaus Wirth in 1978. It was intended to be a especially suitable in educational establishments for teaching structured programming. It proposed a standard which was regrettably broken almost immediately by implementors who made popular implementations of Pascal (such as Turbo Pascal). I taught Pascal programming at Sacred Heart College in the early 1980s to 7th Form Applied Mathematics classes.

9.1 Hello World!

program hello(input, output)

10 C

In contrast to Pascal, the C programming language had no intention of becomming a standard but did! It’s original purpose was to provide a way to implement the newly invented UNIX operating system on other hardware than the original DEC (Digital Equipment Corporation) VAX PDP11 computer. Subsequent versions of Unix were rewritten in C. The project was so successful that C become and has remained the chosen language for creating all new operating systems.
The book The C Programming Language which was published in 1978 written by Brian Kernighan and Dennis Ritchie is, in my opinion, the best computer language book ever written. It sets out the essence of the language with minimum verbosity and maximum examples.

10.1 Hello World!

#include <stdio.h>
	printf("Hello World!\n");

The original version of C did not require the #include statement.

11 Informix 4GL

Informix 4GL came to New Zealand in 1986. My first year as a programmer in the computer industry. Working for Expert Software I was invited to be the first user of 4GL in a commercial project. The result was exsur a complete insurance application which allowed an underwriter employing only half a dozen staff to create, renew, and cancel policies, administer claims, and do the works. The application allowed the user to enter formulas to calculate all the relevant monetary values such as premium, taxes, levies, and so on without having to have anything reprogrammed. The proof of that was the change of GST from 12.5% to 15% which went without a hitch.
Informix 4GL was a language with all the normal stuff plus special functions for menus, input and display of arrays, and especially it allowed SQL statements to be included in line in the code to access database values.
For many years it was the most used programming in New Zealand, surpassing Cobol, Fortran, etc as business programming languages.

11.1 Hello World!

end main

12 AWK

Named from its authors Aho, Weinberger, and Kernighan awk is a report language which expects to read an input or inputs and repeatedly process lines. It is still used and availible in Unix, Linux, and Mac OSx but most people now prefer perl (and maybe python) for similar applications for which awk is suited.

12.1 Hello World

awk ’BEGIN { print “Hello World!” }’

13 perl

Larry Wall, a professional linguistics scholar and a part-time Unix systems administrator designed a Practical Extraction and Report Language (PERL) or alternatively a Pathologically Eclectic Rubbish Lister. It is a superset of sed and awk and like awk it expects to read input and for every line executes the code you write as an interpreter shell.
An important feature of perl is its understanding of Regular Expressions (REs).

13.1 Hello World!

print “Hello World!”

14 Object Oriented Languages

Object Orientation is a program design philosophy where you gather together variables, functions, and procedures into a collective template called a class.
You then create instances of that class called objects. To communicate with objects you send messages to the object.

15 Python

Python was invented by Guido van Rossum of Amsterdam who enjoyed Monty Python’s Flying Circus. It was released into the public domain in 1991 and comes with Linux and Mac OSX systems. Python aims at being a simple, neat, and easy to read and understand language.
Python’s most distinctive feature is its use of indentation where other languages use begin .. end or { .. }.
Python can be regarded as a tidier version of perl

15.1 Hello World

print (“Hello World!”)

16 Java

Invented by James Gosling of SUN MicroSystems in 1995 but now owned by Oracle Corporation. Java derives its syntax from C and C++. Like C++ it is an object oriented language.
Java compilers produce not directly executable computer code but instead a low level langauge called bytecode which is run on a Java Virtual Machine (JVM). Lots of other language developers are now aiming at producing compatible JVM bytecode executables. Many applications on websites and Galaxy phones run java bytecode.
Java is an object oriented program and has Classes and Objects as do C++ and modern versions of perl, python, and ruby.

16.1 Hello World!

public class Hello {
	public static void
	main( String[] args)
		System.out.println("Hello World!");
To compile the above file you run the command: javac and then to run the compiled code, run the command: java Hello
As you can see Java is wordier than most other languages.

17 C++

Created by Bjarne Stoustrup of Bell Labs, C++ aims at being an object oriented version of C. I don’t like it myself as I find the hierarchy of Classes and Interfaces and their inheritance inelegant and confusing.

17.1 Hello World!

#include <stream.h>

18 Ruby

Created by Yukihiro Matsumoto, ruby is intended to eventually be able to share bytecodes with perl and python. A completely new design from the ground up, but heavily influenced by perl and python, ruby is completely and consistently object oriented. perl and python had object oriented capabilities grafted onto them.

18.1 Hello World!

print “Hello World!\n”