?index.php
A stack of strings that wants to be a shell, a script and a markdown page at once. It loops by appending itself to itself.
Dragoneater67, 2026 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Dragoneater67 made ?index.php in 2026, with the goal of being as useful as possible. It has commands that print a string as a heading, in bold, in italics, as a bullet or underlined, a command that runs a string in another thread, and !, which runs a name it does not know as a shell command with the whole stack as its arguments.
Read the story
It has no loop and no condition. A program can push its own text with \ and append a string to itself with ^, so \^ makes it run again, twice as long each time. A choice is a custom command named TRUE or the empty string, run with ! on the result of a test. The specification shows it is Turing complete by writing the I/D machine in it.
This implementation runs the strings, variables, custom commands and the growing program. It leaves out the headings, bold, italics, bullets and underline, as the specification does not say how they look, and the threads, the random character and the shell.
The machine
| Command | Does |
|---|---|
"s" | Push s, up to the next " |
# | Pop a string and print it as it is |
% ; | Duplicate, swap |
, | Push a line feed |
+ | Pop two strings and push them joined |
= > < | Push TRUE or the empty string for equal, the lower one longer, the lower one shorter |
~ & | | Push TRUE or the empty string for not empty, both not empty, either not empty |
$ @ | Set a variable, push a variable |
: ! | Make a custom command, run one |
\ ^ | Push the running program's text, append a string to it |
. | Halt |
A backtick drops the top string. $ and : pop the name first and then the value. A variable that was never set holds the empty string. Every other character does nothing.
Example
The quine pushes its own text and prints it.
The quine pushes its own text and prints it.
The truth machine makes two commands. 0 prints, and 1 prints, pushes its own text and appends it, so it runs again. The specification writes the input as i; this implementation uses 0.
A choice is a custom command named after the answer. TRUE prints and the empty name drops, and > asks whether the lower string is the longer one.
Patterns it teaches
- Stack machines: every value is a string on one stack.
- Self-modifying code:
^appends to the running program, which is how it loops. - Quine:
\#prints itself in two characters.
Further
See also
Markup languages
Concurrent programming
Write your own in Run Convert a program from ?index.php
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: index-php.
Command line
shib run index-php -e '\#'shib manual index-phpSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/index-php.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org