Tarflex

Tarflex is a reflective turing tarpit invented by Adrian Toncean in 2012. It is an imperative language, designed to be as minimalistic as possible while also allowing reflection.

Language overview
There are basic instructions for incrementing, decrementing, copying, jumping, storing into an indexed memory and retrieving data from it, reading from input and writing to the output. Variables need not be declared - every variable is automatically initialized with 0. There are no numeric literals.

The language is reflective - the program may alter its program code at runtime using specific instructions. Because of its minimalistic nature, the program code can be viewed as a list of labels and every label can be viewed as a list of instructions. There are specific instructions for adding or removing instructions or labels.

To output the program code at any moment use the !selfprint instruction.

Comments start with a "/" and must be on their own line. Empty lines are ignored.

Adding 2 numbers
read a read b


 * l1

dec a inc r if a > z goto l1


 * l2

dec b inc r if b > z goto l2

outv r

Printing Hello World with reflection
inc a inc a inc a inc a inc a


 * l2

push l1 outs Hello push l1 outs World push l1 outnl dec a if a > z goto l2


 * l1

!selfprint

Reversing instructions with reflection

 * orig

outs message 1 outs message 2 outs message 3


 * int

if isempty orig goto prev unshift rev head orig shift orig if z == z goto int


 * prev

outnl


 * rev

!selfprint

External resources

 * Online Tarflex interpreter (JavaScript)