Computers can understand the instructions only when they are written in their own language called the machine language. Therefore, a program written in any other language should be translated into machine language.
Translator is a special program which accepts the user programs and check each statement and if it is grammatically correct, it produces a corresponding set of machine code instructions.
There are three forms of translators:
- Compilers
- Interpreters
- Assemblers
Compilers
- Besides the application software and the system software, there is a third kind of software called the compiler software.
- Compiler is a system program that translates source code (user written program) into object code (binary form).
- The whole source code file is compiled in one go and a complete.
- This means that the program can only be executed once the translation is complete.
- It is 5-25 times faster than an interpreter.
- Ex- C & C++ are most popular compiled language.
Interpreter
Translate the high level language and execute the instruction before passing on
to the next instruction.
- An Interpreter is contrast to a compiler, analyzes & executes the source code line- by – line without looking at the entire program.
- First it translates & executes the first line then it moves to the next line of the source code & repeats the process.
- It is a slow process.
- It is used in FORTRAN program.
- Ex- JavaScript & VBScript are interpreted language.
Assemblers
- Assembler is a program which translate on assembly language program in to machine language is called assembler .
- It takes the basic commands and operations from assembly code and converts them into binary code that can be recognized by a specific type of processor.
- Assemblers are similar to compilers in that they produce executable code.