Pxem
The program is the file name. The file itself can stay empty.
nk., 2008 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 18 known programs · Test method
Run it
The idea
nk. (then known as ぬこ) played code golf on anarchy golf, where GolfScript let some problems be solved with one-byte files. Pxem was the answer to that, a language for zero-byte files, published in 2008. The code is written in the name of the file, and the content is only read when the name asks for it.
Read the story
A command is a dot and one character. Everything else in the name is text, and the text before a command is pushed onto the stack just before the command runs, first character on top. So hello world.pxe is a Hello World. Its .p pops and prints the whole stack, and the xe after it is pushed and never printed.
The machine
One stack of integers, a one-value register, and the file's content.
| Code | Does |
|---|---|
.p .o .n | Print the whole stack as text, one character, one number |
.i ._ | Read a byte (-1 at the end), read a number |
.c .s .v | Duplicate, drop, reverse the stack |
.f .e | Push the content as text; run the content as code |
.w .x .y .z … .a | Loop while not 0, while less, while greater, while not equal |
.t .m | Pop into the register, push it back |
.+ .- .! .$ .% | Add; larger minus smaller; multiply; larger divided by smaller; remainder |
.r .d | A random number below the top; end |
The first line of a program is the file name and the rest is the content.
Example
.z pops two letters and loops while they differ.
.z pops two letters and loops while they differ. It eats a b, c d, e f, f g and stops at g g, which leaves hijj. Numbers are made the same way from pairs of characters, 12.- being 50 minus 49, or 1. The echo program uses that to add 1 to each byte it reads, so the loop ends when -1 comes back as 0.
The FizzBuzz is a file name of 213 characters, and prints 1 to 100.
Further
- esolangs.org/wiki/Pxem
- The author's blog, in Japanese, with the original interpreter
Ideas it shows
See also
Probabilistic
Nondeterministic
Write your own in Run Convert a program from Pxem
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pxem.
Command line
shib run pxem -e '42.pxe'shib manual pxemSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pxem.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org