ECLiPSe provides a number of different tools and libraries to assist the programmer with program development:
- Tools for generating documentation from ECLiPSe sources.
- Generates warning messages for dubious programming constructs and violation of naming conventions for an ECLiPSe source module or file.
- Tools for pretty-printing a file in different formats.
- Enables the analysis of an ECLiPSe source module or file for the construction of a predicate call graph.
In addition, ECLiPSe provides several tools that aid in the understanding of a programs runtime behaviour:
- Records the frequency at which various parts of the program are executed.
- Provides a low level view of program activity. Chapter 14 presents a comprehensive look at debugging of ECLiPSe programs.
- Display matrix
- Shows the values of given terms in a graphical window. Chapter 4 discusses the use of this tool.
- Mode Analyser
- Collects statistics about the invocation modes of predicates within a running program in order to assist in the generation of compiler invocation mode directives.
- Port Profiler
- Collects statistics about the running program in terms of box model port counters.
- Timing Profiler
- Samples the running program at regular intervals to give a statistical summary of where the execution time is spent.
- Visualisation framework
- A graphical environment for the visualisation of search and propagation in constraint programs. The Visualisation Tools Manual discusses the use of this environment.
This section focuses on the program development libraries and two complementary runtime analysis tools, the profiler and the coverage library. Throughout this chapter, the use of each of the tools is demonstrated on the following n-queens code:
:- module(queen). :- export queen/2. queen(Data, Out) :- qperm(Data, Out), safe(Out). qperm(, ). qperm([X|Y], [U|V]) :- qdelete(U, X, Y, Z), qperm(Z, V). qdelete(A, A, L, L). qdelete(X, A, [H|T], [A|R]) :- qdelete(X, H, T, R). safe(). safe([N|L]) :- nodiag(L, N, 1), safe(L). nodiag(, _, _). nodiag([N|L], B, D) :- D =\= N - B, D =\= B - N, D1 is D + 1, nodiag(L, B, D1).