From Esolang
Jump to navigation Jump to search

Headass is an esoteric programming language by discord user thejonymyster#7537.


Memory consists of 4 registers and an array

Register Description
r0 Current register
r1 Accumulator
r2 Stored register
r3 Comparison register

The array starts with a single null value.


Before executing the program, add a null value to the start of the input.

Instruction List
Instruction Description
U Remove the first input, then set r0 to new first input. If input is empty, set r0 to 0.
R Set r0 to the first input.
N Set r0 to 1 if the input is empty, else set r0 to 0.
D Set r0 to r1, and set r1 to 0.
^ Add the value in r0 to r1.
+ Add 1 to r0.
- Subtract 1 from r0.
[ Set r2 to r0, and set r0 to 0.
] Add the value in r2 to r0.
{ Start loop.
} Jump to matching {.
( Set r3 to r0, and set r0 to 0.
< If r0 is less than r3, set r0 to r3, else set r0 to 0.
> If r0 is greater than r3, set r0 to r3, else set r0 to 0.
) If r0 is not equal to r3, jump to the next :. set r0 to r3.
: Jump to next ;.
; A nop.
P Print r0.
? Print debug info.
O Push r0 to the array.
E Replace all inputs with the array, and set the array to a single null value again, then jump to a code block given by r0 (where 0 is the start of the program). Clear registers 0-3. If r0 is negative or larger than the number of blocks, halt.
. Separate code blocks. If execution reaches a . or the end of the program, halt.




Truth machine


Hello World


Bubble sort


Computational class

Headass is Turing complete, as it is able to interpret Bitwise Cyclic Tag, shown below. Expected input is each bit of a BCT program as a separate input, followed by -1 as a divider, finally followed by each bit of input data as a separate input. For example: (1,1,0,1,0,0,-1,1,0) would run the program 110100 with 10 as input data.

NO(+):UO(-):{N(+);(++++++++E:UO(-):};N(+)(++++++++E:{UON()}:(+E  // init
.U+OR[{(]):UOD+^};UO[{UON()}:(](-)(++E:()(+++E:(++++E            // read instruction and move instruction pointer
.UDO{UON()}:(+E                                                  // loop to first instruction
.UO{(-):UO};UPN(+)(++++++++E:{UON()}:(+E                         // print and delete first bit of memory
.U+OR[{(]):UOD+^};UO[{UON()}:(](-)(+++++E:()(++++++E:(+++++++E   // check arg of "1" command and move instruction pointer
.UDO{UON()}:(++++E                                               // loop to first instruction within "1" command subroutine
.UO{(-):UO};UO[{N()UO}:(](+)(O:;(+E                              // add 0 to end of memory
.UO{(-):UO};UO[{N()UO}:(](+)(+O:;(+E                             // add 1 to end of memory
.N.                                                              // halt


Headascii is a slight derivative of Headass, focused on printing characters rather than numerical output. Though it is named after ascii, it can support other character encodings per interpreter. A string register is added, one instruction is changed, and two are added to accommodate.

Instruction Description
P Concatenate r0 as a character (by character code) to the string register.
! Print the contents of the string register.
@ Clear the contents of the string register.


Using Headascii, a proper quine is possible.


Because nobody wants to sift through character codes to verify a quine.

Hello World again

Programs in Headass can easily be converted to Headascii by adding ! (and sometimes @) instruction(s) where appropriate. Here is a proper Hello, World! which outputs on one line.



There is an implementation that's hosted here which supports both standard Headass and Headascii, last updated October 5 2021.

here is a Headass interpreter