Wednesday 13 June 2012

TRANSLATOR

Sometimes two people cannot understand each other because they don’t speak the same language. So they need the help of a third person who understands both languages. This third person is known as a translator.
All software packages or programs are written in high-level languages, for example, C++, Visual Basic and Java.
However, in order for the computer to be able to carry out the instructions, the high-level languages must be translated into machine language before the computer can understand and execute the instructions in the program.
The translation of high level languages to machine language is performed by a translator.

ASSEMBLER

An assembler is a computer program for translating assembly language — essentially, a mnemonic representation of machine language — into machine language.
For example in intel 80836, the assembly language for the ’no operation’ command is NOP and its machine code representation is 10010000.
Example of assemblers are MACRO-80 Assembler and Microsoft MASM.

INTERPRETER

Interpreter is used to interpret and execute program directly from its source without compiling it first. The source code of an interpreted language is interpreted and executed in real time when the user execute it.
The interpreter will read each codes converts it to machine code and executes it line by line until the end of the program.
Examples of interpreter-based language are BASIC, Logo and Smalltalk.




COMPILER

The source code (in text format) will be converted into machine code which is a file consisting of binary machine code that can be executed on a computer. If the compiler encounters any errors, it records them in the program-listing file.
When a user wants to run the program, the object program is loaded into the memory of the computer and the program instructions begin executing.
A compiled code generally runs faster than programs based on interpreted language. Several programming languages like C++, Pascal and COBOL used compilers as their translators.

1 comments: