File "hack"

This file allows working with π-WAM without backends. The concept of a π-WAM embraces a fusion of a process (π) calculus and a Warren Abstract Machine (WAM). Optimized for speed the WAM is very primitive, but already supports all ISO control constructs, plus 32-bit integer basic arithmetic and the between/3 generator.

The execution proceeds in two steps, first the given Prolog goal is prepared into a sequence of instructions for a Hack VM, and then this sequence is executed on such a Hack VM. The pred-icate instructions/1 allows the display of the Hack VM instructions. The predicates emulate/[1,2] runs the instructions on a 100% Prolog abstract Hack VM.

The following hack predicates are provided:

instructions(G):
The predicate succeeds. The predicate pretty prints the π-WAM instructions of the goal G to the current output.
emulate(G):
emulate(G, O):
The predicate succeeds. As a side effect it emulates G on an abstract π-WAM. The only side effects consumed or produced by the π-WAM is their input and output. The binary predicate allows specifying hack options. The following hack options are recognized:

size(S): The total number S of logical threads.
comm(C): The channel table C for communication.