Roco

Roco is programming language using a form of coroutines, designed by Lode Vandevenne in 2007. The coroutines are very basic, they have no input or output parameters, and their instruction pointer is never copied or reset. If a coroutine doesn't call ("ca" or "ac") or yield ("yi") another coroutine, it simply loops forever: if the instruction pointer reaches the end of a coroutine, it goes back to its beginning and continues running. Coroutines can be nested, and the top level of the source code is the root coroutine, which is called "ro". You can't achieve recursion by making a coroutine call or yield itself, because it just continues where it was.

In this simplified environment, all variables are 32-bit integers on one large heap. Roco supports literal integers, variables (denoted by numbers in square brackets) and pointers to variables (denoted by numbers in double square brackets).

A Brainfuck interpreter has been written in Roco, which proves that it's Turing complete.

Example
The following is a Hello, world! program in Roco that yields to different coroutines:

/* roco "Hello world!" with yielding */ /*define all the coroutines*/ co H{cout 72 yi ro} co e{cout 101 yi ro} co l{cout 108 yi ro} co o{cout 111 yi ro} co spc{cout 32 yi ro} co w{cout 119 yi ro} co r{cout 114 yi ro} co d{cout 100 yi ro} co excl{cout 33 yi ro} /*yield the coroutines to form "Hello World!"*/ yi H yi e yi l yi l yi o yi spc yi w yi o yi r yi l yi d yi excl /*ac at the end, or the program will loop forever*/ ac

External resources

 * Specification, interpreter source code and examples