The Compiler

The compiler translates Prolog source files into byte-code object files. It is written entirely in Prolog. The byte code for the compiler can be found in the SB-Prolog system directory cmplib, with the source code resident in cmplib/src.

Byte code files may be concatenated together to produce other byte code files. Thus, for example, if foo1 and foo2 are byte code files resulting from the compilation of two Prolog source programs, then the file foo, obtained by executing the shell command

cat foo1 foo2 > foo
is a byte code file as well, and may be loaded and executed. In this case, loading and executing the file foo would give the same result as loading foo1 and foo2 separately, which in turn would be the same as concatenating the original source files and compiling this larger file. This makes it easier to compile large programs: one need only break them into smaller pieces, compile the individual pieces, and concatenate the byte files together.

The following sections describe the various aspects of the compiler in more detail.



Subsections