Saturday, September 20, 2008

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



For detailed understanding of the what compiler does and other compiler related articles visit compiler section: COMPILER SPECIFIC 



Assembly / Linking

 

13 comments:

AttitudeMonger said...

That was a really useful post. The differences between these stuff are so subtle that sometimes it tests your understanding. Thanks a lot...

miss u all said...

it was really helpful.. and may give clear idea to those who are beginersu

Unknown said...

thanks for the nice post
its very sweet and short

Shamy said...

can i get some more info

Navneet said...

The post is really good. I loved it. It helped me alot to know basic difference between all of them.

Isha.with.Azure said...

hey . thanks a lot . .that was very good post . easy to understand..thanks a lot !!!!

Unknown said...

Thank you for giving this valuable information with suitable manner.

Unknown said...

Thanks for the post it was really helpful

Stock Market Learning said...

Its really helpful and so easy.. specially flow diagram show a clear picture and understanding... thanks buddy :)

ABC said...
This comment has been removed by the author.
ABC said...
This comment has been removed by the author.
ABC said...

It was really helpful for me. I also found another guide on the web which I think can be of great help to the readers here. Do check it on Compiler and Interpreter. This tutorial will help to get a good understanding on the comparison part. I hope you all like it.

Unknown said...

Really helpful to see the difference of these things loved it