Section "stack"

To have no stack limit, we avoid the native stack and use a manually programmed stack for certain unary and binary predicates. An exception to this approach is major and minor garbage collection that we do with a Peter Deutsch algorithm extended from binary cells to n-ary compounds, using an integer index walk instead of bit combinations.

Where possible the algorithms are tail recursive, so that the extra stack only grows for Prolog arguments except for the last one, making the approach suitable for large list processing. This also illustrates our decision, to not use the logging from union find where possible, and use two main passes to undo markings or functor modifications instead.

The following stack host calls are provided:

stack_push(S, E, T): host language
The function returns the same stack extended by an element.
stack_peek(S, E): host language
The function returns the top element or null.
stack_pop(S): host language
The routine removes the top element from the stack.




Use Privacy (c) 2005-2026 XLOG Technologies AG