esolang

Print Function Deluxe

One accumulator, and a print that always takes three characters.

Cortex, 2019 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, World!

The idea

Cortex made Print Function Deluxe in 2019 to have very small code. A command takes its argument from the characters right after it. Most take one character, read as a digit in base 36, so z means 35. The command p prints the next three characters of the program, and the specification says it is the only way to see what a program did. A $ in front of a command gives it a value from the input instead, and a ^ gives it the accumulator.

The machine

CommandDoes
pPrint the next 3 characters
%Set the accumulator to the next 3 characters in base 36
&Set the accumulator to the next character in base 36
+ -Add or take away the next character in base 36
*Double the accumulator
?Set the accumulator to a random number
=If the accumulator is even, go forward n lines
@Go to line n
.End
$ ^Give the next command a line of input or the accumulator

Lines count from 1. With ^ in front, p prints the accumulator in base 10.

Example

Hello, World! is five prints of three characters each, so it ends with two spaces.
Expected: 70

Hello, World! is five prints of three characters each, so it ends with two spaces. In the second program &z sets the accumulator to 35 and * doubles it.

The truth machine reads a number with $&. On 0 the accumulator is even, so =1 goes one line on, where it prints 0 and ends. On 1 it goes to line 3 and prints 1 forever.

Expected: 0

Further

Also in Turing tarpits

Write your own in Run Convert a program from Print Function Deluxe

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: print-function-deluxe.

Command line

shib run print-function-deluxe -e '$p' --input 'Hello'
shib manual print-function-deluxe

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/print-function-deluxe.js

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

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