NextPrevUpTopContentsIndex Tail Recursion

The KnowledgeWorks Backward Chainer supports the transformation of "tail-recursive" calls into jumps. Thus, stack overflow can be avoided without resorting to "repeat, fail" loops in most cases. For example, given the definition:

(defrule run-forever :backward

the call: (run-forever) will run forever without generating a stack overflow. Note that this optimization is not limited to recursive calls to the same rule. The last call of any rule will be compiled as a jump, drastically reducing stack usage.

KnowledgeWorks and Prolog User Guide (Windows version) - 29 Feb 2008