Java Reference
In-Depth Information
high-level languages
fourth-generation languages
In order for a program to run on a computer, it must be expressed in that
computer's machine language. Each type of CPU has its own language. For that
reason, we can't run a program specifically written for a Sun Workstation, with
its Sparc processor, on a Dell PC, with its Intel processor.
Each machine language instruction can accomplish only a simple
task. For example, a single machine language instruction might copy
a value into a register or compare a value to zero. It might take four
separate machine language instructions to add two numbers together
and to store the result. However, a computer can do millions of these
instructions in a second, and therefore many simple commands can
be executed quickly to accomplish complex tasks.
Machine language code is expressed as a series of binary digits and is extremely
difficult for humans to read and write. Originally, programs were entered into the
computer by using switches or some similarly tedious method. Early programmers
found these techniques to be time consuming and error prone.
These problems gave rise to the use of
KEY CONCEPT
All programs must be translated to a
particular CPU's machine language in
order to be executed.
assembly language, which replaced
binary digits with mnemonics, short English-like words that represent commands
or data. It is much easier for programmers to deal with words than with binary
digits. However, an assembly language program cannot be executed directly on a
computer. It must first be translated into machine language.
Generally, each assembly language instruction corresponds to an equivalent
machine language instruction. Therefore, similar to machine language, each assembly
language instruction accomplishes only a simple operation. Although assembly
language is an improvement over machine code from a programmer's perspec-
tive, it is still tedious to use. Both assembly language and machine language are
considered low-level languages.
Today, most programmers use a high-level language to write soft-
ware. A high-level language is expressed in English-like phrases, and
thus is easier for programmers to read and write. A single high-level
language programming statement can accomplish the equivalent of
many—perhaps hundreds—of machine language instructions. The
term high-level refers to the fact that the programming statements are expressed in
a way that is far removed from the machine language that is ultimately executed.
Java is a high-level language, as are Ada, C++, Smalltalk, and many others.
Figure 1.19 shows equivalent expressions in a high-level language, assembly
language, and machine language. The expressions add two numbers together. The
assembly language and machine language in this example are specific to a Sparc
processor.
KEY CONCEPT
High-level languages allow a pro-
grammer to ignore the underlying
details of machine language.
 
Search WWH ::




Custom Search