next up previous contents
Next: 7.1 CM variables Up: CM The SML/NJ Compilation Previous: 6.2.7.2 Directory scanning:   Contents


7. Conditional compilation

In its description files, CM offers a simple conditional compilation facility inspired by the preprocessor for the C language [KR88]. However, it is not really a pre-processor, and the syntax of the controlling expressions is borrowed from SML.

Sequences of members can be guarded by #if- #endif brackets with optional #elif and #else lines in between. The same guarding syntax can also be used to conditionalize the export list. #if-, #elif-, #else-, and #endif-lines must start in the first column and always extend to the end of the current line. #if and #elif must be followed by a boolean expression.

Boolean expressions can be formed by comparing arithmetic expressions (using operators <, <=, =, >=, >, or <>), by logically combining two other boolean expressions (using operators andalso, orelse, =, or <>, by querying the existence of a CM symbol definition, or by querying the existence of an exported ML definition.

Arithmetic expressions can be numbers or references to CM symbols, or can be formed from other arithmetic expressions using operators +, - (subtraction), *, div, mod, or $\tilde{~}$ (unary minus). All arithmetic is done on signed integers.

Any expression (arithmetic or boolean) can be surrounded by parentheses to enforce precedence.



Subsections
next up previous contents
Next: 7.1 CM variables Up: CM The SML/NJ Compilation Previous: 6.2.7.2 Directory scanning:   Contents
Matthias Blume
2001-07-19