TRANSLATOR (Lesson 4)

All software packages or programs are written in high-level languages, for example, C++, Visual Basic and Java. The translation of high level languages to machine language is performed by a translator.

PROGRAM
Have you ever wondered how your computer runs your favourite software?
Your favourite software is a program that consists of several instructions that perform its operation. A programmer will write a source code which consists of the instructions needed to run a program. Then the compiler or interpreter with assembler will translates the source code into machine language which is made of a sequence of bits (eg. 01100011). The computer will load the machine code and run the program.

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.

INTERPRETER
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.