git @ Cat's Eye Technologies Unlikely / master eg / count.unlikely
master

Tree @master (Download .tar.gz)

count.unlikely @masterraw · history · blame

class Count(Count,Chain,Print,Add) extends Continuation

class CountForever(Count,Chain,Print,Add) extends Program {
  Count c;
  method continue(Passive accumulator) {
    c = new Count(Passive,Count,Chain,Print,Add);
    goto c.continue(new 1(Passive));
  }
}

class Count() extends Continuation {
  Count c;
  Print p;
  Add a;
  method continue(Passive accumulator) {
    c = new Count(Passive,Count,Chain,Print,Add);
    a = new Add(Passive,Chain);
    a.value = new 1(Passive);
    a.next = c;
    p = new Print(Passive,Chain);
    p.next = a;
    goto p.continue(accumulator);
  }
}