Generations
Programming Language - a definition
A vocabulary and set of grammatical rules for instructing
a computer to perform specific tasks.
These days the term programming language usually refers
to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada , and Pascal. Each
language has a unique set of keywords (words that it understands) and a special
syntax for organizing program instructions.
Although difficult to define and the edges are blurred
there have been three “generations” of programming and we are now moving into
another, distinct programming language.
Generation
|
Example
|
Comment
|
First
|
Machine code/binary
|
Slow to program, prone to error, difficult to debug.
Very steep learning curve.
|
Second
|
Assembler language
|
Equivalent to machine code but faster to enter commands
(mnemonics). Less error prone. Both the first and second generation are low
level languages.
|
Third
|
Fortran, Cobol, Pascal , Basic, C
|
High-level programming languages - closer to human
understanding. Sometimes called “imperative” or “procedural” languages since
the programmer needs to define exactly how to solve a problem.
|
Fourth
|
Often abbreviated 4GL.
|
Nobody can precisely define what makes up a fourth
generation language but they are closer to human languages than typical
high-level programming languages. Most 4GLs are used to access databases. For
example, a typical 4GL command is
FIND ALL RECORDS WHERE NAME IS "SMITH"
Commands replace several third level language commands
- so programmer productivity is increased but overall running speed, when
compared to third (and even more the second generation), is slower.
|
The overall effect of moving up the generations is to
· increase the productivity of the programmer
· make one statement in a higher level language represent many in a low level
one
· require more powerful hardware since the translators at the higher level
need to do more work
· reduce the speed of the final product when compared to writing the same
commands in a lower level language. This is because the complex translation
process add redundant commands.
· make the finished product more robust (less prone to errors). This is
largely because the more powerful compilers have greater error
checking/de-bugging together with more structured programming techniques. Also
“meaningful” variable names make it easier to debug.
There is a similar sequence of generations with the
hardware that makes up the computer but this will be dealt with in a different
module.
Translators - Assembler
Translators
If you are unable to speak French and yet wish to
communicate a French speaker then you need someone to translate English into
French. The same happens with computers languages. We would like to communicate
in English but the computer only understands binary - so a translator is
required. Thus the basic function of a translator is to convert a SOURCE (or
original) program into an Object (or binary) program. There are three main
categories of translator: Assemblers, Interpreters and Compilers. Under normal
circumstances (ie unless great speed or compactness is required) the source
program will be written in a high level language which is either Interpreted or
Compilers.
Assembler
In the early days of programming, machine code (binary)
was the only option. Unfortunately this was laborious, prone to error and
difficult. A slight improvement on this was the use of hexadecimal or octal
which reduced the number of errors and the time to enter the program (See Binary
notes). Eventually assembly languages were developed which were easier and more
productive to use whilst preserving the speed and compactness of machine code.
Assembly languages vary from one type of computer to
another (or more correctly from processor to processor) which results in a
difficulty in transporting programs from one computer to another. If any
routines are used that are specific to a particular to a particular computer
(eg graphics routines for a particular graphics card) then these program would
need to be re-written. This problem can be avoided by using operating system
calls - see later.
Assemblers are the simplest of all the translators to
understand since the majority of the statements in the source code are
mnemonics (short words that help you to remember something) representing
specific binary patterns - the others being labels, directives (or pseudo-ops)
which give instructions to the assembler.
So, for instance, rather than enter the binary pattern
01011100 which might mean “Increment the contents of the Accumulator by 1” we
could type in the mnemonic “INC” which the assembler would translate into the
appropriate binary pattern.
Interpreters
An analogy to an interpreter program would be someone who translated from English to French by using a English/French dictionary. The output would be just about understood but it would be very crude
No comments:
Post a Comment