6.1 Program Source
When reading the input source, the compiler distinguishes
clauses and directives.
Directives are terms with main functor
:-/1
or
?-/1.
When the compiler encounters them, it executes immediately
their first argument as a Prolog goal.
If this goal succeeds, the compiler continues to the next
input term without reporting the answer to the user.
If the directive fails, an event is raised.
All other input terms are interpreted as clauses to be compiled.
A sequence of consecutive clauses whose heads have the same
functor is interpreted as one procedure, and so e.g.
if the clauses of one procedure are mixed with directives or
with clauses for another procedure, the compiler
takes them as several different procedures.
To allow the user to write non-consecutive procedures,
the compiler raises an event whenever it
encounters several procedures with the same name and arity
in one file, or when a procedure defined in one file
is being redefined in another file.
Default action for the former is to emit a warning,
for the latter the new procedure just replaces the old one.
The library scattered redefines the former handler
so that procedures which are scattered in one file are accepted
as normal static procedures.