The computer works only with the binary code. Therefore, the programs written in high-level language must be converted into the machine language for execution by the computer. Special programs are used to convert a source code into the object code. These programs are called language processors.
Every high level programming language has its own language processor. The language processors are divided into two categories. These are:
1: Compilers
2: Interpreters
1: Compilers:
The language processor that translates programs written in ahigh level language into the machine understandable language as
a whole is called the compiler. If there is any error in the source
program, the compiler specifies the error at the time of compilation.
All errors must be removed before the compiler can successfully compile
the source program.
A computer cannot understand the spoken or written language
that we humans use in our day to day conversations,
and likewise, we cannot understand the binary language
that the computer uses to do it's tasks.
A C++ compiler is itself a computer program who's only job
is to convert the C++ program from our form to a form the
computer can read and execute. The computer prefers a string
of 1's and 0's that mean very little to us, but can be very
quickly and accurately understood by the computer.
The original C++ program is called the "source code",
and the resulting compiled code produced by the compiler
is usually called an "object file". One or more object files are combined with predefined
libraries by a linker, sometimes called a binder, to produce
the final complete file that can be executed by the computer.
A library is a collection of pre-compiled "object code"
that provides operations that are done repeatedly
by many computer programs.
2: Interpreter:
A program that can analyse and execute aprogram line by line.OR
The language processor that executes a source
program by translating and executing one instruction at a
time is called interpreter. If there is any error in the instruction it indicates the
error and program execution stops.
The interpreter translates the program instructions
one by one and excuses them immediately. It does not create an
object program. Thus the interpreter translates the source
program each time the program each time the program is executed.
This method of translating and executing a program is slow and
time consuming.A BASIC Language Processor is an example of
Interpreter.
Linker:
The linker uses in the programming which combine thefiles created by the compiler in one executable file.
Linker can take objects from a collection called a library.
OR
A linker combines one or more object files and possible
some library code into either some executable,
some library or a list of error messages.
Linker can take objects from a collection called a library.
Depending on the library (system or language or external
libraries) and options passed, they may only include
its symbols that are referenced from other object files
or libraries. Libraries for diverse purposes exist,
and one or more system libraries are usually linked
in by default. We will take a closer look into
libraries on the Libraries Section of this book.
Loader:
A loader reads the executable code into memory,does some address translation and tries to run the
program resulting in a running program or an error
message (or both).
No comments:
Post a Comment