Compiler, Assembler, Linker, Loader
Compiler:
C is high level language(Human understandable).
But, computer understands only binary values of 1's and 0's.
Computer does not understands our english like languages.
So, compiler converts are english like language to 1's and 0's.
Also, compiler checks syntax.
If syntax is not correct it gives error.
But, computer understands only binary values of 1's and 0's.
Computer does not understands our english like languages.
So, compiler converts are english like language to 1's and 0's.
Also, compiler checks syntax.
If syntax is not correct it gives error.
Assembler:
When we write a program in assembly language (for e.g.: 8085 microprocessor programs or 8086 microprocessor programs, etc.) then again computer doesn’t understand it.
So, assembler is used to convert assembly language programs to binary 1’s and 0’s which computer can understand.
It performs same functions as compiler performs.
Linker:
When we write a program using in-build functions like printf() or scanf() from #include<stdio.h> then we are using functions which are already predefined in C libraries.Thus, when compiler or assembler converts our high language code in binary language and we try to execute program then linker tries to search for used function in program(like printf() or scanf()) and matches it with functions in in-build libraries (#include<stdio.h>) and if it finds function then it links function with binary code else it prompts an error to user.
Let’s see this photo below to understand better:
- Firstly, we write a C program and save it with .c extension.
- Then we compile it.
- Then compiler or assembler converts our high language code in binary language and saves file with .obj extension.
- Then linker links function called in program with in-build function.
- If function matches then new file with .exe extension is created.
- This .exe file is executed.
- Program's output is displayed.
Loader:
Function of loader is to load program in RAM.
No comments:
Post a Comment