class Hello(Print,Stop) extends Chain {
Print p;
method continue(Passive accumulator) {
p = new Print(Passive,Chain);
p.next = new Stop(Passive);
goto p.continue(new "Hello, world!"(Passive));
}
}
class PrintTwice(Print) extends Print {
Print p1;
Print p2;
method continue(Passive accumulator) {
p2 = new Print(Passive,Chain);
p2.next = next;
p1 = new Print(Passive,Chain);
p1.next = p2;
goto p1.continue(accumulator);
}
}
class HelloProgram(Hello,PrintTwice,Chain,Stop) extends Program {
Hello h;
method continue(Passive accumulator) {
h = new Hello(Passive,Chain,PrintTwice,Stop);
goto h.continue(new 0(Passive));
}
}