Simulation of other Paradigms and Continuations - slide 15 : 43 |

Imperative | Functional - Scheme |

Begin L1: if B1 then goto L2; S1; if B2 then goto L2; S2; goto L1; L2: S3; End | - |

/* Rewritten - equivalent */ Begin L1: if B1 then goto L2; else begin S1; if B2 then goto L2; else begin S2; goto L1; end end L2: S3; End | (letrec ((L1 (lambda () (if B1 (L2) (begin S1 (if B2 (L2) (begin S2 (L1))))))) (L2 (lambda () S3))) (L1)) |

#include | Same |