Computer Knowledge

Language Processors or Translators: Assembler, Compiler and Interpreter

Language Processors or Translators Assembler, Compiler and Interpreter

Language Processors or Translators in Programming and its types- Assembler, Compiler and Interpreter

Language translator or Processor

To express our idea we use a suitable language. Same in the computer system, to make a dialogue, a language is required. The language is known as programming language. The programming language is generally used to give command or instruction to computer. It is required to translate into machine format. For a translation of programs, language processor is used. Computers understand instructions only when they are written in the machine language. Machine language is in binary form that is its instructions consist of zeros and ones.

Definition of Language Processor

A language translator is a program which is used to translate an input program written in one programming language into another programming language (output program). Language processor is also called a language translator.

A program written in any high-level programming language is called the Source code or program. To convert the source code into machine code is called the object code or program. A Translator translates the source program into the object program that the computer can understand and execute.

Types of Language Processor or Translators

In programming Language processors are  three types:

  1. Assembler
  2. Interpreter
  3. Compiler

Translators or Processors types

1.Assembler

Assembler is a translator which is used to translate the assembly language code into machine language code.
Assembly language is a low level programming language where we use the symbols called mnemonics in place of machine codes. The assembler performs a one to one mapping from mnemonic statement into machine codes and data. The translated program is called as object program.
Assembler works

Advantages of Assembler

  • Assembler is Very fast translating assembly language to machine code as 1 to 1 relationship.
  • Efficiency in execution just like machine level language.

Disadvantages of Assembler

  • Assembly language is difficult to understand. it is a low-level programming language.
  • It is difficult to maintain.

2.Interpreter

Interpreter converts the source program written in high level language into machine languages.
An interpreter converts each statement of the program line by line into machine code. It means an interpreter translates the one line at a time into machine language and executes it. Then moves towards the next line this goes on till the end of the program. If no error encounters.
Interpreter stops and highlights the problem and will not move to next line when any errors are encountered.
A interpreter requires a less storage space in primary memory than a compiler.
Interpreter works

Advantages of Interpreter

  • Interpreter is that it makes easy to trace out and correct errors in the source program.
  • Interpreters over compilers are that an error is found immediately.

Disadvantages of Interpreter

  • It is a time consuming process of translating and executing statements one by one.
  • Programs execution is slow.

3.Compiler

The purpose of compiler is same as interpreter but unlike interpreters which translate the source program line by line, compiler are the translators, which translate the entire program into machine codes.
If source program contain errors, the compiler highlights a list of errors at the end of the execution of the program. i.e. a compiler translates the whole program before execution. A compiler is a larger program and occupies more memory space. It is costlier than interpreter.
Compiler Works

Advantages of compiler

  • Producers and executable file, and therefore the program can be run without need of the source code.
  • A compiler converts a high-level program that can be executed many times.

Disadvantages of compiler

  • It is slow to execute as you have to finish the whole program.
  • It is not easy to debug as errors are shown at the end of the execution.

Difference between Compiler and Interpreter

S. No. Compiler Interpreter
1 A compiler takes the whole program as a single unit and compiles it at once Interpreter each line in translated or converted one by one and executed
2 It stores an object file. It does not store an object file.
3 Occupies more memory space Occupies less memory space
4 Program execution is very fast. Program execution is slow.
5 Debugging is harder Debugging is easier
6 Translator program is required to translate the program each time you want to run the program. Translator program is not required to translate the program each time you want to run the program.
7 More useful for commercial purpose More useful for learning purpose
8 Costlier then interpreter Cheaper than compiler
9 Compiler are good for a very long program Interpreter is good for small programs.
10 Example :C compiler, PASCAL compiler, FORTRAN compiler etc Example : Basic interpreter, Prolog interpreter, LISP, APL etc.

Related Posts Fundamental of Computer

You Might Also Like