Internal Clause Rewriting

YAP supports several clause optimisation mechanisms, that are designed to improve execution of arithmetic and term construction built-ins.

In other words, during the compilation process a clause is rewritten twice:

  1. first, perform user-defined goal_expansion as described in the predicates goal_expansion//11 and goal_expansion//22.

  2. Perform expansion of some built-ins like:

  3. pruning operators, like ->//22 and F>//22

  4. arithmetic, including early evaluation of constant expressions

  5. specialise versions for some built-ins, if we are aware of the run-time execution mode

The user has some control over this process, through some built-ins and through execution flsgs.

Functions:

1. *** prolog::contains_illegal_dcgnt(+Term) is semidet.%% True if Term contains a non-terminal we cannot deal with using% goal-expansion. The test is too general approximation*: