Invoking the Compiler

The compiler is invoked through the Prolog predicate compile:

| ?- compile(InFile [, OutFile ] [, OptionsList ]).
where optional parameters are enclosed in brackets. InFile is the name of the input (i.e. source) file; OutFile is the name of the output file (i.e. byte code) file; OptionsList is a list of compiler options (see below).

The input and output file names must be Prolog atoms, i.e. either begin with a lower case letter or dollar sign `$', and consist only of letters, digits, and underscores; or, be enclosed within single quotes. If the output file name is not specified, it defaults to InFile.out. The list of options, if specified, is a Prolog list, i.e. a term of the form

[ option1, option2, …, optionn ].
If left unspecified, it defaults to the empty list [].

In fact, the output file name and the options list may be specified in any order. Thus, for example, the queries

| ?- compile('/usr/debray/foo', foo_out, [v]).
and
| ?- compile('/usr/debray/foo', [v], foo_out).
are equivalent, and specify that the Prolog source file `/usr/debray/foo' is to be compiled in verbose mode (see ``Compiler Options'' below), and that the byte code is to be generated into the file foo_out.

The compile predicate may also be called with a fourth parameter:

| ?- compile(InFile, OutFile, OptionsList, PredList).
where InFile, OutFile and OptionsList are as before; compile/4 unifies PredList with a list of terms P/N denoting the predicates defined in InFile, where P is a predicate name and N its arity. PredList, if specified, is usually given as an uninstantiated variable; its principal use is for setting trace points on the predicates in the file (see Section [*]), e.g. by executing
| ?- compile('/usr/debray/foo', foo_out, [v], L), load(foo_out), trace(L).
Notice that PredList can only appear in compile/4.