Overview

Underload is a Turing-complete stack based programming language. Elements on the stack are of variable length and manipulated by a set of eight instructions.

Instruction set

Instruction Description ~ exchange the top two elements : duplicate the top element ! discard the top element * concatenate the top element to the end of the second element a enclose the top element in parentheses S output the top element then discard it ^ remove the top element then execute it ( ) add a new element containing everything between the parentheses

Example Programs

Hello, World!

A simple program to demonstrate output in Underload:

(Hello, World!)S

First (Hello, World!) adds a new element containing “Hello, World!” to the stack. Next, S displays and discards the element.

Quine

A quine is a program which outputs its own source code:

(:aSS):aSS

First (:aSS) adds a new element containing “:aSS” to the stack:

:aSS

Then : duplicates the top element. The new top element is to the right:

:aSS :aSS

Next a encloses the top element in parentheses:

:aSS (:aSS)

Finally SS will display and discard the top two elements.

Implemention in Redcode