next up previous index
Next: Compiling Procedures as Up: More about compilation Previous: Compiling from a

File Queries and Directives

A file being compiled may contain queries. These are goals   preceded by either the symbol ``?-'' or the symbol ``:-''. As soon as a query or command is encountered in the compilation of a file, the ECLiPSe system will try to satisfy it. In this way, in particular, a file can contain a directive to the system to compile another file, and so large programs can be split between files.   When this happens, ECLiPSe interprets the pathnames of the nested compiled files relative to the directory of the parent compiled file; if e.g. the user calls

[eclipse 1]: compile('src/pl/prog').
and the file src/pl/prog.pl contains a query
:- [part1, part2].
then the system searches for the files part1.pl and part2.pl in the directory src/pl and not in the current directory. Usually larger Prolog programs have one main file which contains only commands to compile all the subfiles. In ECLiPSe it is possible to compile this main file from any directory, whereas in other Prolog systems it might be necessary to make the directory of the main file the current one, or to specify in the main file the full pathnames for all compiled subfiles.

  If the compile/1 predicate is called and the system is unable to find or open the required file, it will issue an error:

[eclipse 1]: [file].
File does not exist in compile('/user/lp/eclipse/src/file')
yes.
[eclipse 2]:

If in compilation of a file file_a the compiler is directed to open or find a file file_b, but cannot do so, it will raise an exception whose default action is to write an error message and continue to compile file_a.



next up previous index
Next: Compiling Procedures as Up: More about compilation Previous: Compiling from a



Micha Meier
Mon Mar 4 12:11:45 MET 1996