@@ -0,0 +1,2052 @@
+import java.util.*;%0A%0A/**%0A * runtime representation of an immutable list of goals%0A * together with top of heap and trail pointers%0A * and current clause tried out by head goal%0A * as well as registers associated to it%0A *%0A * note that parts of this immutable lists%0A * are shared among alternative branches%0A */%0Aclass Spine %7B%0A%0A  /**%0A   * creates a spine - as a snapshot of some runtime elements%0A   */%0A%0A  Spine(final int%5B%5D gs0, final int base,  final int ttop, final int k, final int%5B%5D cs) %7B%0A    hd = gs0%5B0%5D;%0A    this.base = base;%0A    //this.gs = IntList.tail(IntList.app(gs0, gs)); // prepends the goals of clause with head hs%0A    this.ttop = ttop;%0A    this.k = k;%0A    this.cs = cs;%0A%0A    System.out.println(%22The head  :%22+hd);%0A    System.out.println(%22The ttop  :%22+ttop);%0A    System.out.println(%22The base  :%22+base);%0A    System.out.println(%22The value of k :%22+k);%0A    //for(int i=0;i%3Ccs.length;i++)%0A    System.out.println(%22The value of cs :%22+Arrays.toString(cs));%0A  %7D%0A%0A  /**%0A   * creates a specialized spine returning an answer (with no goals left to solve)%0A   */%0A  Spine(final int hd, final int ttop) %7B%0A    this.hd = hd;%0A    base = 0;%0A   // gs = IntList.empty;%0A    this.ttop = ttop;%0A    System.out.println(%22The head of the :%22+hd);%0A    System.out.println(%22The ttop of the :%22+ttop);%0A    k = -1;%0A    cs = null;%0A  %7D%0A%0A  final int hd; // head of the clause to which this corresponds%0A  final int base; // top of the heap when this was created%0A%0A  //final IntList gs; // goals - with the top one ready to unfold%0A  final int ttop; // top of the trail when this was created%0A%0A  int k;%0A%0A  int%5B%5D xs; // index elements%0A  int%5B%5D cs; // array of  clauses known to be unifiable with top goal in gs%0A  public static void main(String args%5B%5D)%0A  %7B%0A%09  int%5B%5D ac= %7B1,2%7D;%0A%09  int%5B%5D aab= %7B3,4%7D;%0A%09  System.out.println(%22Calling the head and tail constructor%22);%0A%09 Spine b=new Spine(10,12);%0A%09 System.out.println(%22End of the HT Constructor%22);%0A%09 System.out.println(%22Calling the main Five constructor%22);%0A%09 %0A%09 Spine a=new Spine(ac,10,10,10,ac);%0A%09 System.out.println(%22End of the Constructor%22);%0A  %7D%0A%7D%0A

Create Spine.java