Compiling Programs

The compiler is invoked through the Prolog predicate compile. It translates Prolog source programs into byte code that can then be executed on the simulator. compile/1 (L) compile/2 (L) compile/3 (L) compile/4 (L) The compiler may be invoked as follows:

| ?- compile(InFile [, OutFile ] [, OptionsList ]).
or
| ?- compile(InFile, OutFile, OptionsList, PredList).

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, and PredList is a list of terms P/N denoting the predicates defined in InFile, where P is a predicate name and N its arity.

The input and output file names must be Prolog atoms, i.e. either begin with a lower case letter and consist only of letters, digits, dollar signs 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 [ ]. 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 Sections [*] and [*]). Notice that PredList can only appear in compile/4.

A list of compiler options appears in Section [*].