1.1. What are Programming Languages?
A programming langauge defines a format for laying out
ordered sets of intructions to be executed by a computer. Programming
langauges can be sorted into three three categories: interpretted
languages, compiled languages, and machine languages. Of these types
only machine languages can be understood directly by a
computer.
A machine langauge is the set of instructions that a
computer's CPU (central processing unit) understands. All
instructions and information are represented by numbers; very fast for
computers, very hard for human brains to read or write. To ease the
task of computer programming, people created easier languages called
assembly languages. An assembly language is
one which provides textual names for the available machine language
commands. This, along with the fact that assembly languages allowed
programmers to add spaces and tabs to their code, made assembly
languages far easier to program with. Assembly code can then be fed
to an assembler which translates it into the
machine language of the target computer's CPU.
The use of assembly languages spread very fast, they became
known as "second generation languages" but there was still
two problems with assembly langauges. Firstly, each command does
only a very basic task such as add two numbers or load a value from
memory. Using these small commands was quite tedious. The second
problem was much bigger. Programs written in an assembly language are
bound to a particular type of CPU. Each type of CPU has it's own
machine language and, therefore, it's own assembly language. The next
task was to design a language that could be translated into the
machine language of many CPUs.
These new machine independant
langauges were known as "third generation" or
"high-level" languages. Designed to be easy to read,
these languages were made up of english words, basic mathematical
symbols and a few punctuation characters. These languages allow
simple statements to be expressioned concisely, for example, adding
two numbers and storing the result in memory could be expressed as:
rather than: