A common form for a command line in Unix is a program name, followed by an arbitrary number of options, followed by an arbitrary number of positional parameters. Options might be Boolean (the presence or absence of the option is important), or they might be associated with integer or string values; positional parameters are normally strings that represent file names.
The format of a command line can be described by a simple declarative specification that gives names to the various options and positional parameters and specifies the type of each value. For example, some common characteristics of the cc command line could be described as follows:
Debug "-g" boolean; OutputFile "-o" string; InputFiles positionals;
A tool called CLP accepts this specification and generates a module exporting variables Debug, OutputFile and InputFiles. The value of Debug will be set to 1 if the -g option is specified on the command line, and 0 otherwise. If the -o option is specified, the string argument will be stored and associated with a definition table key. This key will be the value of OutputFile. Otherwise the value of OutputFile will be the distinguished value NoKey. InputFiles will point to a list of definition table keys, one associated with each positional parameter string. This list may be empty.
The remainder of the compiler can access the information from the command line by accessing the variables exported by the module CLP creates. (Note that this module depends on the definition table module.)