Wednesday, 4 November 2015

C Preprocessor


Preprocessor is the first component of tool chain which gets invoked after editor in a tool chain.It is a program which accepts input in high level programming language such as c and c++ and convert that input into expanded source code.

Instead of scanning the whole program preprocessor scans only such lines which starts with # symbol.
According to this hash symbol gives direction to the preprocessor due to which hash sign is called as preprocessor directive symbol.


This preprocessor symbol performs multiple tasks such as:-

1.>Tokenization and white space removal
2.>File Inclusion
3.>Macro Expansion
4.>Conditional Compilation

After performing all this tasks our expanded code is still in high level programming language and then that source code is passed towards the compiler for remaining processing.

We learn preprocessor in tool chain as it is the only component with which programmer interacts by giving commands to it.