Java Reference
In-Depth Information
1. load the value y from memory into register 1
2. load the value z from memory into register 2
3. multiply registers 1 and 2, putting the result in register 1
4. load the value of x from memory into register 2
5. add registers 2 and 1, putting the result in register 2
Of course, these instructions need to be represented as binary (or hexadeci-
mal) numbers. Writing in the machine language, or a symbolic version of it
called an assembly language, can be tedious and error-prone, and that is why
“high-level” languages like Java have been developed.
So how does a Java program get executed? First, a software program called
a compiler translates the Java program into an equivalent machine language pro-
gram. Then, the machine language program is executed. The compiler makes
sure that the program is syntactically correct , i.e. it follows the grammar rules of
the programming language, including punctuation. If not, the compiler does not
translate the program. When attempting to compile a program, we often get com-
pile-time error messages , telling us what is syntactically wrong with the source
program. We then have to fix these syntactic errors and try to compile again. We
guarantee that you will see many of these error messages!
Deep thought: a compiler must have been written to compile the first com-
piler. How?
Now that you know a little bit about programming languages, we give you
a perspective on the field of programming by presenting a brief history.
Early programming languages
During the early 1950s, when commercial computers first became widely
available (to companies, not to individuals, because the computers cost millions
of dollars), the main programming languages used were assembly languages. It
took a long time to write, test, and debug an assembly-language program; con-
sequently, programs had very little functionality, meaning they did not do much
by today's standards. Not much emphasis was placed on how to write programs,
i.e. on the programming task. Instead, maintaining the massive, expensive com-
puter was the focus of most effort! Input to these computers was either by “IBM
punch cards” or paper tape, which had to be prepared on other machines; there
were no simple keyboards and mice attached to these computers! Generally, one
gave the program to the systems group, who inputted it to the computer, ran it,
and gave you back the program and the output —perhaps several hours later.
In the middle 1950s, the programming language Fortran I was developed
and a compiler was written for it by IBM under the direction of John Backus (it
took over 30 man-years to produce!). Fortran had the essential components of
most procedural programming languages today: assignment statement, condi-
tional statement, for-loop, variables, arrays, and subroutines (procedures and
functions). It was the first widely used procedural language. Backus and his col-
leagues worked extremely hard to make the compiler and the machine-language
Search WWH ::

Custom Search