Anonymous

What is the difference between preprocessor and macroprocessor?

1

1 Answers

Natalie Holeman Profile
Natalie Holeman answered

1.  A macro-processor(MP) may be a pre-processor(PP) depending on the use of the output.

2.  A PP converts data.  The output of a PP is ALWAYS the input into another program.  It will typically rearrange data, convert data (like time formats), translate data (one program uses M/F for male/female and another uses 0/1, ...).

Typically PP are programs that do not allow users to write programs that are executed by the PP.  All instructions on how to handle data are included in the PP.

3.  A MP also converts data.  A MP accepts input and generates an output usually by copying the input file and performing instructions coded into the input that invoke the MP to convert the data at that point.

A MP often allows users to write programs (macros) that provide instructions on what operations to perform on the data.

A MP may also execute a program (macro) on an input that has predefined instructions generating an output.  An Excel macro is a perfect example of this type of MP executing a macro on an input.

The output of one macro may be tin input to a subsequent macro.  An example of a MP acting as a PP is when you have an Excel report that is generated by executing multiple macros.  Each macro is essentially a PP generating input to the next until the final macro is executed and the report generated.  The final macro generates input to nothing so it is not acting as a PP.

Compilers/Interpreters/Assemblers are examples of MP that will typically only include the converted input in the output (comments are excluded) yielding a long string of machine language instructions.  This type is considered MP mostly because of the inclusion of user written macros and macro calls in the source code.

Answer Question

Anonymous