Writing a Preprocessor Overview

This topic explains how to write an integrated preprocessor and describes the interface used to pass information between a preprocessor and the Compiler.

Although a preprocessor could be written in a language other than COBOL, the following description assumes that it is written in COBOL.

The Integrated Preprocessor Interface works on the simple concept that preprocessing is a form of editing. The preprocessor marks each line of the source code as:

When compiling a COBOL program, the compiler calls the preprocessor instead of directly reading the source file and receives the code line by line from the preprocessor.

The operation of the debugger depends on a mapping of each line of object code onto each line of source code. The marking of source lines described above allows this mapping to be valid even though the object code does not match the source code.

Testing a Preprocessor

The preprocessor program should be compiled in the same manner as any other program you want to debug.

After compiling your preprocessor program for debugging, you use the debugger as though you want to debug the Compiler itself, that is debug COBOL. You will not see the Compiler debugged, since it is not compiled for debugging, but you will see any programs it calls that have been compiled for debugging, such as your preprocessor.