It is a language processor which is to process or convert one language into another form of language. In order to compile C++ program we need to have four type of translator which are as fallows.

Preprocessor: – It is a translator which takes high level language as input (.CPP file) and produces still has high level language but with expanded length of code as output.

First.CPP

  1. #include<iostream.h> //Preprocessor
  2. #include<conio.h> //Preprocessor
  3. void main()
  4. {
  5. clrscr();
  6. cout<<“This Is My First Program In C++”;
  7. getch();
  8. }

Note: – Before preprocessor phase the length of First.CPP was eight but after preprocessor phase expanded or increase as per the size of iostream.h and conio.h. File suppose iostream.h has 500 line of code and conio.h has 200 line of code. Then total number of lines of code after preprocessor begin 706. According to First.CPP program.

Compiler: – It is translator which takes high level language as input and produces assembly level language as output.

Note: –

  1. At compilation time compiler compiles our local file (First.CPP) from top to bottom.
  2. At run time or execution time the control of compiler start from main function and till main function exit.
  3. Compiler always check syntactical error.

Assembler: – It is a translator which takes assembly level language as input and produces machine level language.

Linker: – It is use to combine the object file of internal file (First.CPP) with the object code of other library files.

Example: –

Suppose First.OBJ has address of 0 to 999 and object code other files has 0 to 499 then linker will arrange the memory as following –

Before Linker

After Linker

0-999

0-999 – (1)

0-499

1000-1499 – (2)

.exe complete file

 

Note: – At compilation time a programmer does following things.

  1. Edit / write program.
  2. Save the program.
  3. Compile the program.
Advertisements