Translator in Computer Programming

In an article titled "What is a programming language and how it evolved and works?", we mentioned that computers only can understand binary numbers (0 and 1). All the instructions we give to the computer, the computer cannot executes them directly. All the instructions must be translated into binary. For translating those, there exists another program, called the translator.

Translator in Computer Programming

What is a Computer Programming Language Translator?

A computer programming language translator is a program that translated a set of code written in a programming language into a functional equivalent of the code in binary code that a computer can understand.

Types of Programming Language Translator

There are 3 types of translators. They are:

  • Assemblers
  • Interpreters
  • Compilers

Assemblers

In this blog post, we linked another post of TechKib in the first line. From there, you can learn about the evolution of programming languages. There, I tried to give a basic idea. You may need those if you don't have them. Hopefully, you have them. So we are going on.

There are 5 generations of programming languages. The first two generation's languages are low-level programming languages. The second-generation programming language is called 'Assembly Language'. The programs or translators that translate assembly language to binary code are called assemblers.

How Assemblers Work?

A programmer writes a program using sequences of assembly language instructions. This is called the source code. Then the source code is specified to the assembler program when that program is started. Then assembles translates the instructions in 0 and 1 that we know as the binary code or number system. This is called the object code or the object program. Then when anyone interested to run the program, can easily execute them.

Interpreters

The interpreter is a program that is used to translate high-level programming languages. After this, we will learn about the compiler. Compilers also translate high-level programming language. But there are many differences. The main one is compiler translates the entire program at once, but the interpreter translates line by line. Interpreters translate one line of the program into binary code at a time.

How Interpretes Work?

Programmers write a program first. Then from the whole source code, an instruction is fetched. Then the interpreter checks the single instruction for errors. The instruction is translated into binary code then. The binary coded instruction is executed and another instruction is fetched after that. This repeats for the entire program.

Compilers

Compilers are also a translator that translates high-level programming languages. But the main difference is it translates the whole program at a time where interpreters do this line by line or instruction by instruction.

How Compilers Work?

First, the compiler checks the entire source code or program for errors. Then it translated all the instructions into binary code. Here, the source code and the object code (binary code) exist at the same time and the CPU attempts execution when the programmer requests.

See Also:

Md. Rabiul Mollah

Okay! So here I'm Md. Rabiul Mollah from Pathgriho Network. I'm currently a student of B.Sc in Textile Engineering Management at Bangladesh University of Textiles. facebook instagram github twitter linkedin

Post a Comment (0)
Previous Post Next Post