Programmers write instructions in various programming languages, some directly understandable
by computers and others requiring intermediate translation steps. Hundreds of
such languages are in use today. These may be divided into three general types:
1. Machine languages
2. Assembly languages
3. High-level languages
Any computer can directly understand only its own machine language, defined by its
hardware design. Machine languages generally consist of strings of numbers (ultimately
reduced to 1s and 0s) that instruct computers to perform their most elementary operations
one at a time. Machine languages are machine dependent (a particular machine language
can be used on only one type of computer). Such languages are cumbersome for humans.
For example, here’s a section of an early machine-language program that adds overtime
pay to base pay and stores the result in gross pay:
+1300042774
+1400593419
+1200274027
Programming in machine language was simply too slow and tedious for most programmers.
Instead of using the strings of numbers that computers could directly understand,
programmers began using English-like abbreviations to represent elementary
operations. These abbreviations formed the basis of assembly languages. Translator programs
called assemblers were developed to convert early assembly-language programs to
machine language at computer speeds. The following section of an assembly-language program
also adds overtime pay to base pay and stores the result in gross pay:
Although such code is clearer to humans, it’s incomprehensible to computers until translated
to machine language.
Computer usage increased rapidly with the advent of assembly languages, but programmers
still had to use many instructions to accomplish even the simplest tasks. To
speed the programming process, high-level languages were developed in which single
statements could be written to accomplish substantial tasks. Translator programs called
compilers convert high-level language programs into machine language. High-level languages
allow you to write instructions that look almost like everyday English and contain
commonly used mathematical notations. A payroll program written in a high-level language
might contain a single statement such as
grossPay = basePay + overTimePay
by computers and others requiring intermediate translation steps. Hundreds of
such languages are in use today. These may be divided into three general types:
1. Machine languages
2. Assembly languages
3. High-level languages
Any computer can directly understand only its own machine language, defined by its
hardware design. Machine languages generally consist of strings of numbers (ultimately
reduced to 1s and 0s) that instruct computers to perform their most elementary operations
one at a time. Machine languages are machine dependent (a particular machine language
can be used on only one type of computer). Such languages are cumbersome for humans.
For example, here’s a section of an early machine-language program that adds overtime
pay to base pay and stores the result in gross pay:
+1300042774
+1400593419
+1200274027
Programming in machine language was simply too slow and tedious for most programmers.
Instead of using the strings of numbers that computers could directly understand,
programmers began using English-like abbreviations to represent elementary
operations. These abbreviations formed the basis of assembly languages. Translator programs
called assemblers were developed to convert early assembly-language programs to
machine language at computer speeds. The following section of an assembly-language program
also adds overtime pay to base pay and stores the result in gross pay:
Although such code is clearer to humans, it’s incomprehensible to computers until translated
to machine language.
Computer usage increased rapidly with the advent of assembly languages, but programmers
still had to use many instructions to accomplish even the simplest tasks. To
speed the programming process, high-level languages were developed in which single
statements could be written to accomplish substantial tasks. Translator programs called
compilers convert high-level language programs into machine language. High-level languages
allow you to write instructions that look almost like everyday English and contain
commonly used mathematical notations. A payroll program written in a high-level language
might contain a single statement such as
grossPay = basePay + overTimePay
From the programmer’s standpoint, high-level languages are preferable to machine and
assembly languages. Java is by far the most widely used high-level programming language
assembly languages. Java is by far the most widely used high-level programming language
Compiling a large high-level language program into machine language can take a considerable
amount of computer time. Interpreter programs were developed to execute highlevel
language programs directly (without the delay of compilation), although slower than
compiled programs run. We’ll say more about how interpreters work in Section 1.9, where
you’ll learn that Java uses a clever performance-tuned mixture of compilation and interpretation
to ultimately run programs. Exercises 7.35–7.37 (in the Special Section:
Building Your Own Computer) guide you through the process of building an interpreter
program.
amount of computer time. Interpreter programs were developed to execute highlevel
language programs directly (without the delay of compilation), although slower than
compiled programs run. We’ll say more about how interpreters work in Section 1.9, where
you’ll learn that Java uses a clever performance-tuned mixture of compilation and interpretation
to ultimately run programs. Exercises 7.35–7.37 (in the Special Section:
Building Your Own Computer) guide you through the process of building an interpreter
program.
No comments:
Post a Comment