THE ROLE OF A TRANSLATOR!
A translator is a program that takes as input a 
program written in one programming language (the source language) and 
produces as output a program in another language (the object or target 
language). If the source language is a high-level language such as 
FORTRAN, PL/1 or COBOL and the object language is a low-level language 
such as an assembly language or machine language, then such a translator
 is called a Compiler.
 The first step involved in executing a program 
written in a high-level language is to translate or compile the source 
program into an object program. Then the resulting object program is 
loaded into memory for execution.
Interpreter: Interpreter is a translator that transforms a source program written in a high level language into an object program containing intermediary code. The intermediate code is then executed by the interpreter. In some cases, the source language itself can be an intermediate language. In that case, the interpreter executes the statements written in the source program line by line.
Interpreters are often smaller than compilers and facilitate the implementation of complex programming language constructs. However, the main disadvantage of interpreter is that the execution time of an interpreted program is usually slow than that of a corresponding compiled object program.
Preprocessor: Preprocessors are one
 kind of translators that take programs is one high level language and 
produce equivalent programs in another high level language.  For example
 there are many FORTRAN preprocessors that map ‘structured’ versions of 
FORTRAN into conventional FORTRAN.
Assembler: An assembler is a translator, which takes an assembly language program as input and converts it into a machine language program.
Need for Translators
Using machine language, programmers communicate 
directly with the computer in terms of bits, registers and very 
primitive machine operations. The instructions are given in the form of 
0’s and 1’s.   This makes programming a tedious and time consuming task 
when the complexity of the algorithm is increased.
All operations and operands are specified in a 
numeric code and hence, the programs written in machine language are 
cryptic. This makes the code impossible to modify in a convenient 
manner.
Symbolic Assembly Language
In an assembly language, we use mnemonic names for both operation codes and data addresses.  For example,
ADD X,Y
is an assembly language instruction for adding the 
content of X and Y registers. Such programs are easier to write and 
understand than machine language programs. Because, numeric codes for 
addresses and operations (in machine language) are replaced with more 
meaningful symbolic codes.
A computer however, can’t execute a program written 
in assembly language. That program has to be first translated to machine
 language, using a program called assembler. The major drawback of 
writing programs in assembly language is that the programmer must be 
intimately concerned with how and where data is represented within the 
machine.
High-Level Programming Language
A High-Level programming language allows a programmer
 to express algorithms in a more natural notation that avoids many of 
the details of how a specific computer functions. For example “A+B” is 
an expression in a high-level language that instructs a computer to add 
the contents of variables A and B. COBOL, FORTRAN, PL/1, ALGOL, SNOBOL, 
APL, PASCAL, LISP and C are some of the more common high-level 
languages.
A high-level language makes the programming task 
simpler, but requires a program to translate its code to the 
corresponding machine code for its execution.
