Sunday, September 30, 2012

Single step compilation of a program

Steps Of Program Compilation In Respective Order :


1. Pre - Processor :

--> I st Stage In Multistage Compilation.
--> It Works Directly On Source File.
--> Converts Input Source File ('.c' etc)  To Expanded Source File('.i') .

                      Where '.i' File Is A Source File ,Which Is :

1.Free From Comments .
2.Macro's Replaced By Respective Definitions.
3.Header Files Included.

Note : Even '.i' Files Are High Level & User Understandable Files.
2.Translator :

--> Converts '.i' file to '.s' file which contains Assembly language instructions . 
Note : '.s' Files Are Also User Understandable But Called As Middle Level Files.

3.Assembler :

-->Converts User Understandable Assembly instructions Files '.s' to machine Understandable Binary Files
' .o'.
Note : '.o' Files Are Pure Low Level Files Which user Can Not understand .

4.Linker :
--> Links The Functions From Library Files Which Are Already In Low Level Instructions.

--> Adds "OS Executable Codes" Which Are Specific To Different Os . Thus Converts "CPU/Machine Understandable" Code('.o') To "OS Understandable " Code('.exe/.out').