EmbLogic's Blog

Compilation Process(Neeraj Mishra)E-25

Compilation Process in C

 

The compilation in c is to compile the program by using a compiler, the compiler which we are using is gcc. There are different process involves in compile a program. The following process are:

  1. Pre-processor
  2. Compilation a. Lexical analysisb. Syntax analysis

    c. Symentic analysis

    d. Intermediate code generation

    e. Optimization

    f. Conversion to assembly language

  3. Assembler
  4. Linker/loader

 

Let suppose we have been taken a program program.c

Pre-processor: In program.c the preprocessor expand all the things which are written with # sign including all header files macros etc… and ignore the things which are written with in /* */ this. Then after this process the compilation process is started.

 

Compilation:In compilation process there are several steps involves

Lexical analysis: In lexical analysis the compiler changes or broken every statement in different tokens like int a = 20,so int is taken in 1st token a in 2nd token and so on.

Syntax analysis:In syntax analysis every statement is checked that any syntax error is there or not.

Symentic analysis:In symentic analysis every token is checked that it is written properly like int..

Intermediate code generation:In this compiler changes the code in its form..

Optimization: In this compiler changes changes the code very short form,make it very small..

Conversion to assembly language:In this the compiler changes the code in assembly language which is machine level language, then the extension of program is ‘.s ‘ in which the memory usage and some other information is given.

Assembler:In this .s extension of program is changes to .o extension which is in binary form and this is also called object file of program.

Linker/Loader:The linker links the header files to .o extension of program and make the executable a.out and save in hard disk, when we run run the program loader loads the program in RAM and execute it…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>