(Ref Capron Ch 12)
Definition: A programming language is a language intended for the description of a program. (Usually so it can be executed on a computer) (MacLennan B J, Principles of Programming Languages)Computers work by turning switches on and off. To represent anything inside a computer, a set of switches are placed into an on or off state. This state, having only two conditions is known as Binary. To represent real world situations, a set of codes have been devised which are based on sets of 8 switches. One bank of 8 is known as a byte.
Computers must represent at least two sets of "information" Instructions and Data.
The instructions are what the computer follows to achieve a particular objective. Data is what the computer works on to to produce information..
There is a major problem in that humans are not computers and computers are not human we dont speak the same language. The computer speaks binary and we speak English. But the computer must get its instructions from humans so some mechanism must be put in place to let us instruct the computers
Machine code - first generation
This is the language of the computer. It is pure binary and it looks like this:
01101111 10001101 01010101
The problem with this is that most people cannot easily read and interpret this. So it is not the "language of choice" of most people. (In the early days of computers, when Binary was the only way to interact with computers, there were people quite fluent in it, but these people were very rare!)
Assembler - second generation
To make things easier, computer programs were written that could translate pseudo-english words into binary. These programs, known as assemblers, made the programmers life a lot easier as they could write their programs in "English pneumonics" and have the computer translate these into binary for them.
Programs written in assembler look like this.
MOV AX,0B800H
MOV ES,AX
MOV DI,0
CLD
REP STOSW
ADD DI,80
INC AL
CMP AL,128
JB INIT
(Source 8088 Assembler, Willen / Krantz)
Each line of the program can be translated into a binary instruction that the computer can then follow.
One of the advantages of programs written in assembler is that they are directly translated into Binary and so run very fast when executed.
One of the disadvantages is that not many people can write programs in Assembler.
Another disadvantage is that the language is computer specific. A program written for one type of computer will not work on another!
Procedural Languages - third generation
To overcome the two problems of assembler programs, a system was invented that would allow people to write programs in a more natural language. Thus Fortran and Cobol were invented. These programs gave the procedure, in a step by step instruction form, the process for solving a problem that the computer could follow. This set of instructions were then "translated" into binary and the computer then could carry out the instructions.
The two methods of translation were as follows.
Examples of procedural languages are Fortran, Algol, PL1, Cobol, BASIC, Pascal and C.
Pascal code looks like this:
assign(infile,'MyDataBase'); reset(infile); Repeat readln(infile, PersonRecord); WriteLn(LPT1, PersonRecord) Until EOF(infile);
Non Procedural Languages
Some programming languages do not give a set of instructions. These languages work on a completely different concept and work on the process of saying "what is to be achieved" as opposed to saying "how to achieve" a solution.
Examples of non-procedural languages are Prolog, KEE, RuleMaster and Clips. En example of a Clips follows:
(defrule computer-move ?whose-turn <- (player-move c) ?pile <- (pile-size ?size) (test (>size 1)) (computer-take ?number sticks-if-remainder 3) => (retract ?whose-turn ?pile) assert (pile-size = (- ?size ?number))) (assert (player-move h)))
(Source Expert Systems, Giarratano/Riley)
Fourth Generation Language forth generation
These are very high level or natural language systems. These enable programmers to create many hundreds of lines of code or complex code structures very easily. An example of this is the Access Database query system that builds Sequential Query Language (SQL) statements simply by just pointing and clicking with a mouse. SQL in itself is a forth generation language.
The image below is from an Access Database and below it is the equivalent SQL statements that relate to the image.

SELECT DISTINCTROW [Student details].stukey, [Student details].surname, [Student details].[given-name], [Student details].form,
[Student choices].subject, [Student choices].[class#]
FROM [Student details] INNER JOIN [Student choices] ON [Student details].stukey = [Student choices].stukey;
Action Text - Computers, Capron H L
Good reference: APC Magazine October 2000 PP92,102
Author Mike Leishman