In: Computer Science
Question:
5. The pre-processor translates an object program into a source program
Answer:
Pre-Processor is a Program that processes its Input Data to Produce output that is used as input to another program. Output manipulated by this is Pre-Processed from of the input data, This Pre-Processed Data is used by compiler programs further on.
Pre-Processor mainly used to perform these three tasks:
1. Removing Comments present in Source High Level Languages.
Comments present in High Level Language, Represented using below params:
(A) //
(B) /* Comment Here */
If any comments present in this above format.
All Comments will be removed from Code and the output code is passed on Compiler Program
2. File Inclusion:
Including all Library Header Files, which are present in pre-processor directives. Below is the Example for the same adding 'stdio.h' header file in High Level Language can be done using like #include "stdio.h"
3. Macro Expansion:
Macros are called as Small Functions, that can be used in different parts of High Level Language. Small Functions dont create a OverHead to any Program. These Macros can be used Recursively again and again. These small macro-functions are pre-processed as object-code. When these macros are used in source-code, object-code is converted as source-code using Pre-Processor Program, So that Compiler Program can use this code.
YES - Pre-Processor translates an Object-Program into a Source Program.