next up previous contents
Next: 6.1 Tool parameters Up: CM The SML/NJ Compilation Previous: 5.2 Version checking   Contents


6. Member classes and tools

Most members of groups and libraries are either plain ML files or other description files. However, it is possible to incorporate other types of files--as long as their contents can in some way be expanded into ML code or CM descriptions. The expansion is carried out by CM's tools facility.

CM maintains an internal registry of classes and associated rules. Each class represents the set of source files that its corresponding rule is applicable to. For example, the class mlyacc is responsible for files that contain input for the parser generator ML-Yacc [TA90]. The rule for mlyacc takes care of expanding an ML-Yacc specifications foo.grm by invoking the auxiliary program ml-yacc. The resulting ML files foo.grm.sig and foo.grm.sml are then used as if their names had directly been specified in place of foo.grm.

CM knows a small number of built-in classes. In many situations these classes will be sufficient, but in more complicated cases it may be worthwhile to add a new class. Since class rules are programmed in ML, adding a class is not as simple a matter as writing a rule for UNIX' make program [Fel79]. Of course, using ML has also advantages because it keeps CM extremely flexible in what rules can do. Moreover, it is not necessary to learn yet another ``little language'' in order to be able to program CM's tool facility.

When looking at the member of a description file, CM determines which tool to use by looking at clues like the file name suffix. However, it is also possible to specify the class of a member explicitly. For this, the member name is followed by a colon : and the name of the member class. All class names are case-insensitive.

In addition to genuine tool classes, there are four member classes that refer to facilities internal to CM:

sml
is the class of ordinary ML source files.
cm
is the class of CM library or group description files.
tool
is the class of plugin tools. Its purpose is to trigger the loading of an auxiliary plugin module--usually with the purpose of extending the set of tool classes that CM understands. See section 11.3 for more information.
suffix
is a class similar to tool. Its purpose is to declare additional filename suffixes and their associated classes. See section 11.3.

By default, CM automatically classifies files with a .sml suffix, a .sig suffix, or a .fun suffix as ML-source, file names ending in .cm as CM descriptions. Failure to classify a member will be reported as an error.



Subsections
next up previous contents
Next: 6.1 Tool parameters Up: CM The SML/NJ Compilation Previous: 5.2 Version checking   Contents
Matthias Blume
2001-07-19