|
What is language translator? |
A computer only understands instructions in machine code. It
is difficult to write computer program directly in machine code. Today, mostly
the programs are written in high level languages such as c/c++ and basic
The program written in high level language must be
translated into machine code before running on the computer. A type of system
software that is used to translate the program written in high level language
into machine code is called language translator. The language translator is
also known as language processor every language has its own language translator
program
Types of Language
Translators
The language processors are divided into three types.
- Compiler
- Interpreter
- Assembler
Compiler
The language translator program that translates the complete
source program into machine code as a whole is called compiler. The c and c++
compilers are best examples of compilers.
The program translated into machine code is called the
object program. The source code is translated into object code successfully if
it is free of errors. If there are any errors in the source code, the compiler
specifies the errors at the end of compilation. The errors must be removed
before the compiler can successfully compile the source code. The object
program can be executed a number of times without translating it again.
The translating process of compiler is shown in the figure
below
SOURCE CODE COMPILER OBJECT CODE
Interpreter
The language translator program that translates the source
code into machine code statement by statement is called interpreter. It
translates one statement of source program into machine code and executes it immediately
before translating the next declaration. It also displays an error message the
GWBASIC is an example of an interpreter program.
The main advantage of interpreter is that it makes easier to
detect and correct errors in the source program.
The main disadvantages of interpreter are:
For this purpose you must have a translator program
permanently in your computer.
Assembler
The language translator program that translates the program
written is assembly language into machine code is called assembler.
Differentiate between
compiler & interpreter
The main difference between compiler and interpreter are as
follows:
Compiler
|
Interpreter
|
It translates source code into object code as a whole
|
It translates the
sources code into machine code statement-by-statement
|
it creates an object file
|
It does not create an object file
|
Program execution is very file
|
Program execution is
slow
|
Translator program is not required to translate the program each time
you want to run the program.
|
Translator program is required to
translate the program each time you want to run the program
|
It is not easier to correct the
errors in the source code
|
It is easier to
correct the errors in the source code
|
Most of the high level programming languages have compiler program
|
A few high level programming languages
have interpreter program.
|
No comments: