A coroutine is basically a function that can be paused during execution (yielded) and resumed at a later time. When a coroutine is called, it runs the coroutine until it yields. When the same coroutine instance is called again, it resumes the coroutine at the last place it yielded. In my implementation, when a coroutine yields, it can also pass information to the caller, as the return value to the function to call the coroutine.
Insanely creative
But it seems that call stack will be leaked and because of indirect circular reference no optimisation (eg tail call elimination) can be applied.