A program that transforms input data in some way before it is read by the main program. In the case of a compiler, the input is source code. The main advantage of using a preprocessor is that it is possible to change the specification of the input data without changing the main program. The separation can also help to make the system's overall behaviour easier to understand. The disadvantage is that performance may be reduced by the extra input and output performed between the two programs.For example, the C preprocessor, cpp, handles textual macro substitution (it acts as a "macro preprocessor"), conditional compilation and inclusion of other files. A preprocessor may be used to transform a program into a simpler language, e.g. to transform C++ into C.
Last updated: 2007-04-05