Computer Language Translator and its Types

A translator is a computer program that translates a program written in a given programming language into a functionally equivalent program in a different language.

Depending on the translator, this may mean changing or simplifying the flow of the program without changing its core. This makes a program that works the same as the original.

Types of Language Translators

There are mainly three types of translators that are used to translate different programming languages into machine-equivalent code:

  1. Assembler
  2. Compiler
  3. Interpreter

Assembler

An assembler translates assembly language into machine code.

Assembly language consists of mnemonics for machine op-codes, so assemblers perform a 1:1 translation from mnemonic to direct instruction. For example, LDA #4 converts to 0001001000100100.

Conversely, one instruction in a high-level language will translate to one or more instructions at the machine level.

The Benefits of Using Assembler

Here is a list of the advantages of using assembler:

The Drawbacks of Using Assembler

Assembly language is written for a certain instruction set and/or processor.

Assembly tends to be optimized for the hardware it is designed for, meaning it is often incompatible with different hardware.

Lots of assembly code is needed to do a relatively simple task, and complex programs require lots of programming time.

Compiler

A compiler is a computer program that translates code written in a high-level language into a low-level language, machine code.

The most common reason for translating source code is to create an executable program (converting from high-level language into machine language).

Advantages of using a compiler

Below is a list of the advantages of using a compiler:

Disadvantages of using a compiler

Below is a list of the disadvantages of using a compiler:

Interpreter

An interpreter program executes other programs directly, running through the program code and executing it line-by-line. As it analyses every line, an interpreter is slower than running compiled code, but it can take less time to interpret program code than to compile and then run it. This is very useful when prototyping and testing code.

Interpreters are written for multiple platforms; this means code written once can be immediately run on different systems without having to recompile for each. Examples of this include flash-based web programs that will run on your PC, Mac, gaming console, and mobile phone.

Advantages of using an interpreter

Here is a list of some of the main advantages of using an interpreter:

Disadvantages of using an interpreter

And here is the list of some of the main disadvantages of using an interpreter:

Computer Fundamentals Quiz


« Previous Tutorial Next Tutorial »


Liked this post? Share it!