Ticker

6/recent/ticker-posts

what is compiler AND Why compiler is called translator


 

Computer use machine language that is binary(0 or 1). User can understand binary language. obviously it is difficult to read and understand the instruction of binary form.Different computer languages

Machine language

That is also called binary language. Computer only understand binary language. That language is also called machine language.That language written in the form of string of binary 0 and 1. Main problem of this language is that it is difficult to read and understand.

Assembly Language

Using assembly language Instruction can be easily written in the form of letter and symbol but not in 0 and 1.Using Assembly language a programmer need not keep track of storage location of data and instruction.

For example

To add two number we write ADD A,B in assembly language.

High level language

Using this language easily write program using programming language like c,c++,java etc.

for example to add two number

c=a+b in high level language.


Computer can understand only machine language and user understand high level language.To solve that problem we require a software program which should convert this machine independent program into machine language because computer can only understand machine language.That software is called translator.

Type of translator that is used to convert high level code into machine understanable code 

  • Compiler
  • Assembler
  • Interpreter
  • Preprocessor
  • linker and loader
using these translator or software user can easily use high level language and write program using language and these translator convert these code into machine code .

Compiler

A compiler is a translator which convert high level language into assembly code and then assembler access this code.
  • Compiler only translate the program.
  • Compiler is fast as they translate whole program at once.
  • C,C++ use compiler to convert program code into machine understandable code.

Compiler also find syntax error encountered during compilation of program. Compiler to convert this pre-processed code into assembly code goes through various phases of compilation that get code.After compilation get Assembly code that is give to the another translator that is assembler that convert assembly code into Relocatable machine code. Again that code pass to the another translator that is linker and loader .

The process of compilation broken into sub-tasks called phases.Each phase is independent of each other.One phase output is input for another phase.



Post a Comment

0 Comments