esolang

Pixiedust

An assembly language made only of *, + and ., so that a program looks like a sprinkle of dust.

Stephen Leppik, 2018 · Turing complete: unknown · ●●● hard · esolangs.org

Tested with 3 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hi!

The idea

Stephen Leppik showed Pixiedust in a 2018 Stack Overflow post. Every line is one instruction, and everything is spelled with three symbols. Registers have two-character names like ++ and .., and a number is written in binary after .*, with + for 1 and . for 0. Whitespace is thrown away, so a program can be spread out to look like glitter.

Read the story

TIO runs the reference Java interpreter, and this implementation keeps it exactly as written. That means some surprises. Every math operation adds, whatever its name. Memory is an empty list, so any use of the memory register fails. Before the program runs, each line is checked, and a math line is checked one character earlier than where it runs. A jump looks its label up with the condition character still in front, so a working loop needs a label both with and without that character.

The machine

LineDoes
*.RECopy expression E into register R
*OPRE1E2Math into R; every operation adds
++EPrint E as a character
.CE1E2Set .. to 1 or 0 for E1 equal (*), less (+) or greater (.) than E2
+.nameA label
+*CnameJump after a label if .. is not 0 (*), is 0 (.), or always

An expression is a register (++ +. .+ .., ** the pointer, *+ an input byte) or a literal .* followed by bits up to the next *.

Example

The second counts in the pointer register **, since a math line validates only in shapes like *+++.**++,…
Expected: ABCDEFGHIJ
Expected: b

The second counts in the pointer register **, since a math line validates only in shapes like *+++.**++, which adds the pointer and ++ into +.. The jump +**L checks for a label L but lands on *L. The last program reads one byte while it is checked and one more when it runs, so it prints the second.

Further

Ideas it shows

Also in Camouflage

Write your own in Run Convert a program from Pixiedust

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run pixiedust -e '++*+' --input 'ab'
shib manual pixiedust

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/pixiedust.js

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

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