Node:Using the Determinacy Checker, Next:, Up:The Determinacy Checker

Using the Determinacy Checker

There are two different ways to use the determinacy checker, either as a stand-alone tool, or during compilation. You may use it whichever way fits best with the way you work. Either way, it will discover the same nondeterminacy in your program.

The stand-alone determinacy checker is called spdet, and is run from the shell prompt, specifying the names of the Prolog source files you wish to check. You may omit the .pl suffix if you like.

% spdet [-r] [-d] [-D] [-i ifile] fspec...

The spdet tool is automatically installed when you install SICStus Prolog. The tool takes a number of options:

Process files recursively, fully checking the specified files and all the files they load.
Print out declarations that should be added.
Print out all needed declarations.
-i ifile
An initialization file, which is loaded before processing begins.

The determinacy checker can also be integrated into the compilation process, so that you receive warnings about unwanted nondeterminacy along with warnings about singleton variables or discontiguous clauses. To make this happen, simply insert the line

:- load_files(library(detcheck),
              [when(compile_time), if(changed)]).

Once this line is added, every time that file is loaded, it will be checked for unwanted nondeterminacy.