Binarization

BinProlog is a small, program-transformation based compiler. Everything is converted to Continuation Passing Binary Clauses:

A rule like

  a(X):-b(X),c(X,Y),d(Y).

becomes

  a(X,Cont):-b(X,c(X,Y,d(Y,Cont))).

A
fact like

  a(13).

becomes

  a(13,Cont):-true(Cont).

A
predicate using metavariables like

  p(X,Y):-X,Y.

becomes

  p(X,Y,Cont);-call(X,call(Y,Cont))).

with
true/1 and call/2 efficient builtins in BinProlog.

You can now try out in BinProlog 3.30 your own binary programs by using ::- instead of :- so that the preprocessor will not touch them2. Otherwise, from the outside, BinProlog looks like any other Prolog.

Binarization allows a significant simplification of the Prolog engine, which can be seen as specialization of the WAM for the execution of Continuation Passing Binary Programs.

As a consequence, a very small emulator (about 60K on Solaris) that often fits completely in the cache of the processor, a more efficient new data representation and some low-level optimizations make BinProlog probably the fastest freely available C-emulated Prolog at this time (812 KLIPS on a Sparcstation 20-41).

This means 3-5 times faster than C-Prolog, 2-3 times faster than SWI-Prolog, 1.5-2 times faster than (X)SB-Prolog and close to C-emulated Sicstus 2.1.