next up previous contents index
Next: 3.10.4.1 Mode Declarations Up: 3.10 The Compiler Previous: 3.10.3 Specialization   Contents   Index


3.10.4 Compiler Directives

Consider a directive

:- foo(a).
That occurs in a file that is to be compiled. There are two logical interpretations of such a directive.
  1. foo(a) is to be executed upon loading the file; or
  2. foo(a) provides information used by the compiler in compiling the file.

By default, the interpretation of a directive is as in case (1) except in the case of the compiler directives listed in this section, which as their name implies, are taken to provide information to the compiler. Some of the directives, such as the mode/1 directive, have no meaning as an executable directive, while others, such as import/2 do. In fact as an executable directive import/2 imports predicates into usermod. For such a directive, a statement beginning with ?-, such as

?- import foo/1 from myfile.
indicates that the directive should be executed upon loading the file, and should have no meaning to the compiler. On the other hand, the statement
:- import foo/1 from myfile.
Indicates that foo/1 terms in the file to be compiled are to be understood as myfile:foo/1. In other words, the statement is used by the compiler and will not be executed upon loading. For non-compiler directives the use of ?- and :- has no effect -- in both cases the directive is executed upon loading the file.

The following compiler directives are recognized in Version 3.0 of XSB 3.8.



Subsections
next up previous contents index
Next: 3.10.4.1 Mode Declarations Up: 3.10 The Compiler Previous: 3.10.3 Specialization   Contents   Index
Terrance Swift 2007-10-05