Language Translator

Language Translator

Language translator is system software that converts a computer program from one language to another. A programmer uses high-level or assembly language to develop a program that doesn’t understand by the computer. So, a Language translator translates language into a format understandable by a computer.
Different types of language translators are:

Assembler:
An assembler is used to translate the assembly language into machine language. An assembler program creates object code by translating combinations of mnemonics and syntax for operations and addressing modes into their numerical equivalents. In an assembly language, the computer has to run the assembler, first translate the assembly language ( source code ) into its equivalent machine langauge ( object code ) and then execute to get the result.

Compiler:
The compiler is used to convert programs in a high-level language to a low-level language all at a time. Compilers are very large programs, with error checking and other abilities. The compilers comes with tools to report errors in the syntax and the logic.

Interpreter:
An interpreter is used to convert programs in a high-level language to a low-level language line by line or a single statement at a time. An interpreter takes very less time to analyse the source code. However, the overall time to execute the process is much slower.

Importantly, an interpreter does not have to generate an intermediary ( assembly ) code, so it is highly efficient in terms of its memory. Continues to translate the program until the first error is encountered. When a mistake is detected, the program stops working, making debugging much easier.

Differences between Compiler and Interpeter.

Compiler Interpreter
1. It translates the whole program into object code at a time. 1. It translates one line or single statement of a program into object code at a time.
2. It traps the error after compiling the complete program. 2. It traps the errors after translating a line of the program at a time.
3. The translating process is incredibly faster. 3. The translating process is slower.
4. Compiler based program is difficult to code and debug. 4. The interpreter based program is easy to code and debug.
5. It saves the object code for future reference. 5. It does not save the object code.
6. New programming languages don’t use compiler. 6. New programming languages use an interpreter.
7. It is usually a larger program and requires larger memory space. 7. It is usually a smaller program and requires less memory space.
8. Examples of compiler based programming language are C, C++ , Java and Pascal etc. 8. Examples of interpreter based programming languages are BASIC, C#, and PHP, etc.