Implementing dif/2 with Open Trees

Author:
Mostowski Collapse, XLOG Technologies AG, Switzerland

Date:
October 06, 2026

Abstract:
We examine the problem of attributed variables from two perspectives. First, we deal with the WAM of a Prolog system, While the basic WAM has extensive tutorial style literature, things might get a little foggy for the more advanced control constructs. We show how catch/3, setup_call_cleanup/3 and undo/1 can be realized inside Dogelog Player without the use of host language native stack by extending the trampoline. While undo/1 can be a building block to manage the state of an attributed variable, the second part is then devoted to cyclic terms as an alternative building block for attributed variable. The report closes with a dif/2 presentation and implementation that is not only performant but can also garbage collect unused attribute variables.

Keywords:
Prolog, Constraint Logic Programming, Scryer, EyeProlog

Download:
attrvars_20261006_dif.pdf


Use Privacy (c) 2005-2026 XLOG Technologies AG