EmbLogic's Blog

Compiler process in ‘C’

Compiler is a software ,which is use for converting the code language to machine language.

the c programe are work in 5 process-

  • Preprocessor
  • compiler
  • assembler
  • linker
  • loader

Preprocessor-In the preprocessor a preprocessor directive (#) and a header file (stdio.h)

int main() the programe are start for exicute.

after that type a code “hello world” use c libraries.

and the last format is return 0; in this point the programe is success full exicute.

after that this process the preprocessor also give a hello.i file.

in hello.i file are include 2. files stdio.h+hello.c file.

Compiler-in this process the compiler are work in 2 pras.

1.pras 

  • lexical analysis
  • syntax analysis
  • intermediate code genration
  • code optimization

the 1st pras process is create a symbol table.

2. pras

  • lexical analysis
  • syntax analysis
  • intermediate code genration
  • code optimization
  • object code genration

and the 2nd pras is compile the code use symbol table.

and compiler create a ” hello.s” file.

Lexical analysis-in lexical process the code is break in tokken,

example- hello world  –>h e l l o w o r l d. 

Syntax analysis-in syntax process the cheak the code in right format.

example (),:,<,>,”””.

Intermediate code genration-in intermediate code genration process the code token also arrange in  highest priority order.

Code optimization-in code optimization process the compiler also optimize code  and resolve  minor error.

Object code genration-in object code genration process the compiler are genrate the full code in objective form.

 in this process the fully code also link of symbol table.

in hello.s file, include “code,data segment,symbol table”.

Assembler-   after the compiler process the code also convert in  assembly language.

and make a hello.o file in .o file include links,data ,code, refrence symbol table.

linkerthe linker process  also linked the code for c library and symbol table.

and make exicutable linkable format and output file-> a.out.

in this file stored in secondry memory .

programe  compiling process is complete

Loader- the programe exicutable linkable format file (secondry memory) to process context (primary memory) through loader.

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>