r/prolog • • 17h ago

SCBM-Prolog v1.70 Released — Improved Garbage Collection

5 Upvotes

I have released SCBM-Prolog v1.70, which addresses a garbage collection issue in v1.60.

The previous version did not handle garbage collection correctly in cases such as the following:

example(X, A) :-
    select(X, [a,b,c], Z),
    member(A, Z).

Both select/3 and member/2 are nondeterministic predicates. When member/2 fails, the proof sequence must not be reclaimed prematurely, since select/3 may still have alternative solutions to explore.

To solve this problem, I modified the compiler to identify and protect proof objects that must remain available for subsequent backtracking.

Although some minor issues remain in v1.70, I believe that the major technical challenges of the SCBM approach have now been resolved.

My goal is to develop a simple and efficient Prolog compiler based on an execution model fundamentally different from the WAM (Warren Abstract Machine).

I hope SCBM will provide an interesting alternative approach to Prolog implementation.

sasagawa888/scbm: SCBM (Sasagawa Continuation Backtracking Model) is an experimental execution model for Prolog. It explores a simple alternative to the WAM, using explicit success and failure continuations and direct compilation to C.