There are two implementations of abort/0. 
The default one uses the exception mechanism (see throw/1), 
throwing the exception
$aborted. The other one uses the C-construct longjmp() to 
discard the entire environment and rebuild a new one. Using exceptions 
allows for proper recovery of predicates exploiting exceptions. 
Rebuilding the environment is safer if the Prolog stacks are corrupt. 
Therefore the system will use the rebuild-strategy if the abort was 
generated by an internal consistency check and the exception mechanism 
otherwise. Prolog can be forced to use the rebuild-strategy setting the 
prolog flag abort_with_exception to false.
halt(0). (57)
user_input. See also the history 
prolog_flag (current_prolog_flag/2). 
The prolog/0 
predicate is terminated (succeeds) by typing the end-of-file character 
(On most systems control-D).
The following two hooks allow for expanding queries and handling the result of a query. These hooks are used by the toplevel variable expansion mechanism described in section 2.8.
user, normally not defined. Query 
and
Bindings represents the query read from the user and the 
names of the free variables as obtained using read_term/3. 
If this predicate succeeds, it should bind Expanded and ExpandedBindings 
to the query and bindings to be executed by the toplevel. This predicate 
is used by the toplevel (prolog/0). 
See also expand_answer/2 
and
term_expansion/2.
user, normally not defined. Expand the 
result of a successfully executed toplevel query. Bindings is 
the query
<Name>=<Value> binding list 
from the query. ExpandedBindings must be unified with the 
bindings the toplevel should print.