11.4 Pragmas

There are many situations where the programmer wishes to give directions to the compiler while the code is being compiled.


turn on/off listing the code to a printer
turn on/off certain compile time checks
compile some sections of code for one machine, some for another

Some implementations do not allow this, but many do, and there is a standard syntax for looking after these situations, even though the actual commands available might vary widely from one implementation to another

A Modula-2 pragma is a directive to the compiler that is included in the source file it is compiling. The (implementation defined) instructions that constitute the directive are placed inside a pair of pragma delimiters "<*" and "*>" and inserted into the code at the point the compiler directive is supposed to take effect.
<* This is a pragma *>
<* listing := true *>

The exact nature of the available pragmas in a given system will have to be checked with the implementation documentation; however, some situations are given in the next section in which pragmas are commonly available.