Difference between Preprocessor, Compiler, Assembler, Linker and Interpreter

Difference between Preprocessor, Compiler, Assembler, Linker and Interpreter

The following article gives succinct and brief description of Preprocessors, Compilers, Assemblers, Linkers and Interpreters. While all of these are in some way used to command a processor to do certain set of actions, there is a subtle difference in each of them. This article also, gives links to other related areas.

Preprocessor: All the preprocessor commands written in a high level language are processed by the preprocessor before compiler takes over.
Example: “#define MAX_ROWS 10”
Preprocessor finds all the places and replaces MAX_ROWS with 10 in the files of the project. Complete information on preprocessor commands can be found here

Compiler: This software, converts the code written in high-level language into object file. Compiler converts all the files of a given project at once.

Assembler: While compiler processes high level languages, assembler has the capability of processing only the low level assembly language. This assembly language is extremely core (microprocessor/platform) specific.

Linker: Linker uses the object files created by the compiler and then uses the predefined library objects to create an executable. This executable is the one which is seen by the common user or microcontroller if the program has to run on a chip.

Interpreter: This is a software tool which interprets the user written code line by line, unlike compiler, which processes everything at once. In this case a single line is executed at a time. It is time consuming and not used in real-time applications.

Following figure shows step by step process for converting a human understandable source file into machine understandable executable file.

Pre-Processing / Compilation / Linking

 

Assembly / Linking 

preprocessor compiler assembler for c language
 
 
This entry was posted in C Programming and tagged . Bookmark the permalink.