Process of compilation

1.2 Process of Compilation

  
Let see how actually code flow in the system before execution.
At first, the code (high-level language) is given to preprocessor then the preprocessor converts that to pure High-level language (when we write a c program the starting lines contain Preprocessor directives, the preprocessor removes the preprocessor directives statements by including the file. This called as file inclusion.)    Then the compiler will take the purely high-level language and converts it into assembly language.
Let see what happens in compiler and how it works
In previous topic (1.1) we discuss what is programming and we touched the topic compiler.
 From the previous topic, we have learned that either a computer code is compiled or interpreted nowadays. The main aim of a compiler is to convert or translate code from one language to another language.  Mainly high-level language (Human Readable) to low-level language (Machine Language).

A compiler can be classified into two phases




The first phase analysis phase of compiler reads the source program, and divide it into parts for check
Lexical, grammar and syntax errors. It generates an intermediate code which fed to the next phase
Synthesis phase as input. In synthesis, phase takes the intermediate code generates the machine code.
------------------------------------------------------------------------------------------------------------------------------------------
Note:
Every language has its own compiler, designed specifically according to the requirements. Can we create our own compiler and then use it? Yes! we can do that.
Thinking about what is token?
The token is the smallest part of or an individual text in code which cannot be divided into smaller elements. we see it about later.
------------------------------------------------------------------------------------------------------------------------------------------

The assembly language code translates by the Assembler into machine code. The output of an assembler is called as object file (It may call as object code). A linker is a program which merges various object file together in order to make an executable file. These executable files are fed into memory by the loader. The loader creates memory space for it and initiates the execution of written code.  

Comments

Popular posts from this blog

Basic input, output and variables

Data Types in C

Variable