Roco is an esoteric programming language based on the concept of coroutines.

Roco was created in 2007 by Lode Vandevenne, and his implementation remains a de facto standard (not to mention that it’s the only one available). Its specification is rather simple, and the language itself has no commercial value, so it hasn’t been standardized.

Roco was created to try out some variations of handling coroutines. It is Turing-complete, as Brainfuck can be implemented in it, and thus theoretically capable of executing any real-life task.

Coroutines are the main element of the language; they are named parts of the program which have neither input or output parameters, nor local variables. Each coroutine has its own instruction pointer which stores the current command. By default coroutines loop forever: once the instruction pointer has reached the end of the coroutine, it moves again to its start. When a coroutine is called, its execution starts not from the start, but from the last position of its instruction pointer; this means, for example, that the recursion can’t be implemented using a single coroutine calling itself.

The only data structure in the language is a heap which stores 32-bit integer variables. The variables can be referenced by their index within the heap, which in turn can be stored in a variable (this variable being a pointer).

Language Instructions

Here i and o denote input and output parameters. Input parameters can be either variables or constants, while output parameters can be only variables.