!7 cprint { class State extends ProbabilisticMachine2.State { IVF1 continuation; public State makeDescendant() { new State s; prepareDescendant(s); s.continuation = continuation; ret s; } void doneWithSubroutine { if (continuation == null) ret; IVF1 cont = continuation; addState(prepareDescendant(new State { run { cont.get(this); } })); } void step { doneWithSubroutine(); } } start-thread { new ProbabilisticMachine2 pm; State s = new { run { print("Hello"); doneWithSubroutine(); } }; s.continuation = state -> { print("World"); }; pm.addState(s); pm.onRunningState = st -> { print("Running state " + st); }; pm.onRanState = st -> { print("Ran state " + st); }; stepAllWithStats(pm); } }