All source programs should be in files whose names have the suffix .P. One of the ways to compile a program from a file in the current directory and load it into memory, is to type the query:
[my_file].where
my_file
is the name of the file, or preferably, the name
of the module (obtained from the file name by deleting the suffix .P).
To find more about the module system of XSB see Section 3.3.
If you are eccentric (or you don't know how to use an editor) you can also compile and load predicates input directly from the terminal by using the command:
[user].A CTRL-d or the atom
end_of_file
followed by a period
terminates the input stream.