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.
- #include<iostream.h> //Preprocessor
- #include<conio.h> //Preprocessor
- void main()
- cout<<“This Is My First Program In C++”;
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.
- At compilation time compiler compiles our local file (First.CPP) from top to bottom.
- At run time or execution time the control of compiler start from main function and till main function exit.
- 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.
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 –
0-999 – (1)
1000-1499 – (2)
.exe complete file
Note: – At compilation time a programmer does following things.
- Edit / write program.
- Save the program.
- Compile the program.