The Bash Shell
◾
61
in
the table, assume they are the same between the shells. For instance,
<
,
<<
,
>
,
>>
, |, *,
and ~ all work the same between the two shells.
2.6 INTERPRETERS
We wrap up this chapter by considering the interpreter. As described in Chapter 1, an
interpreter is a program whose task is to execute instructions.
2.6.1 Interpreters in Programming Languages
We generally categorize programming languages as interpreted and compiled languages.
A compiled language, which includes languages like C, C
++
, Ada,
and Pascal, requires that
the program written in that language be translated all at once from its source code into the
executable code of machine language. In most of these languages, the entire program must
be completely written before translation can take place. C and C
++
are
exceptions in that
pieces of code known as functions can be compiled without having to compile pieces of
code that these functions might call upon.
The compiler is a program which performs this translation process, converting an entire
program into an executable program. The compiled approach
to programming is com-
monly used for large-scale applications as will be described below.
The interpreted approach to programming utilizes an environment in which the pro-
grammer enters instructions one at a time. Each instruction, upon being entered,
is inter-
preted. That is, the interpreter accepts the input, parses it, converts it into an appropriate
executable instruction(s), and executes it. This differs greatly
from the compiled approach
because it allows the programmer to experiment with instructions while writing a pro-
gram. Thus, a program can be written one instruction at a time. This certainly has advan-
tages for the programmer who might wish to test out specific instructions without having
to write an entire program around those instructions.
Another disadvantage with compiled programs is that they are compiled to run on a
specific platform. If for instance we compile a C program for a Windows computer, then
that compiled program would not run in a Linux environment
nor could it run on an HP
mainframe. The programmer(s) must compile the source program in every format that the
program is destined for.
While the translation time is roughly the same between compiling any single instruction
and interpreting any single instruction, we desire to have applications
compiled before we
TABLE 2.8
Differences between Bash and TC Shell
Do'stlaringiz bilan baham: