compile/1

Synopsis

compile(+Files)

Compiles the specified Prolog source file(s) into memory.

Arguments


Files file_spec or list of file_spec [MOD]
a file specification or a list of file specifications; a .pl extensions may be omitted in file specifications.

Description

Reads Prolog clauses from the specified file or files and adds them to the Prolog database, after first deleting any previous versions of the predicates they define. Clauses for a single predicate must all be in the same file unless that predicate is declared to be multifile.

If there are any directives in the file being loaded, that is, any terms with principal functor :-/1 or ?-/1, then these are executed as they are encountered.

When compile/1 is called from an embedded command in a file being compiled by qpc, the specified files are compiled from source into QOF.

If desired, clauses and directives can be transformed as they are loaded. This is done by providing a definition for term_expansion/2 (see load_files/[1,2]).

When compile/1 is called in a runtime system, all predicates are loaded as dynamic predicates. The reason for this is that the compiler is not available in runtime systems.

This predicate is defined as if by:

     compile(Files) :-
             load(Files, [load_type(compile)]).
     

For further details on loading files, see ref-lod.

Exceptions

Same as for load_files/[1,2]

See Also

multifile/1, dynamic/1, no_style_check/1, style_check/1, nofileerrors/0, fileerrors/0, source_file/1, term_expansion/2, prolog_load_context/2, load_files/[1,2], ensure_loaded/1, use_module/[1,2,3], volatile/1, initialization/1.