esolang

Jackass

A stack machine written in nothing but hexadecimal numbers.

Phase, 2015 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello, World!

The idea

Phase made Jackass in 2015. The way it works is inspired by Brainfuck, but it runs on a stack, and every command is a two-digit hexadecimal number. The specification lists the fifteen commands in the order they were thought of, and says that order is on purpose.

The machine

CommandDoes
01 nPush the hexadecimal number n
02 06Pop; copy the top
03 04Swap the top two; bring the third value to the top
05Pop a number and go to that command
07 08 09 0a 0bPush the sum, difference, product, quotient or remainder of the top two
0c 0dPrint the top as a number or as a character
0e 0fRead a number, or a line as characters

The specification leaves a few things open, and its truth machine settles them. Arithmetic keeps its two values and pushes the result on top. 08 takes the second value from the top. 05 counts commands from 0, with 01 and its value as one command, and going to the end stops the program.

Example

Hello World pushes each character, prints it and pops it again.

Hello World pushes each character, prints it and pops it again.

The truth machine reads n, prints it and works out 13 minus 12 times n. On 0 it goes to command 13, the end of the program. On 1 it goes back to command 1 and prints 1 for ever.

Expected: 0

The numeric cat prints every number it reads and stops with an error when there are none left.

Expected: 789

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from Jackass

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: jackass.

Command line

shib run jackass -e '0e 0c 01 0c 09 03 02 01 0d 08 03 02 03 02 05' --input '0'
shib manual jackass

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/jackass.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org