Pyhton [sic]
A Hello World that is its own output. The program is the text, and running it as code prints it.
Something Fawful, 2019 · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Something Fawful made pyhton [sic] in 2019. The name is a deliberate typo of Python with the [sic] built in, so a quote that misspells Python can never be told apart from one about this language. The specification asks for a lower case p at the start of a sentence.
Read the story
The machine counts in base 7. Each character of a program stands for two septits, base 7 digits, from a table of 49 characters. The only way to print is OUT, which prints the start of the program itself, three septits to a character. So the Hello World is the text Hello World and also a program that, run from its first septit, sets the output size to 33 septits and prints them.
The machine
A register of 7 septits, and the program, which is also the memory.
| Septits | Does |
|---|---|
0 | Nothing |
1 r 2 r 3 r | Change septit r of the register by one of three fixed tables |
40 | Read an integer into the register |
41 a | Write the register into the program at address a |
42 | Print the start of the program |
43 | Make the program one septit longer |
44 | Set how many septits 42 prints, from the register |
45 | End |
46 | Run the register as the next 7 septits |
5 | Loop forever |
6 a | Jump to address a |
An address has as many septits as it takes to name every septit of the program, 2 for a program of up to 49 septits and 3 for one of up to 343. There is no conditional jump. A program branches by writing the register over its own code.
Example
The first program begins with the septits of the text it prints.
The first program begins with the septits of the text it prints. Run as code, those septits are harmless changes to the register, and its last characters ~|8 are AOS, OUT and END. The second jumps over its text to septit 36, sets the output size to 36, writes the register over its first 7 septits, which then hold He, and ends with OUT and END.
The short truth machine sets the output size to 3 septits, reads the input and turns it into the register 0000065 for 0 or 0000063 for 1. It writes that over its own code at septit 11, where the last two septits become the address of a jump, to 35 on 0 and to 21 on 1. Each branch writes the septits of its digit to the start of the program and prints them. The branch for 1 jumps back to print again, forever.
The longer truth machine takes every multiple of 7 as 0 and every other number as 1, and runs the same way.
Further
Ideas it shows
See also
Self-modifying
Write your own in Run Convert a program from Pyhton [sic]
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pyhton-sic.
Command line
shib run pyhton-sic -e ''\''~i.'\''Il ]]#^;);Il^60);0=' --input '0
'shib manual pyhton-sicSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pyhton-sic.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org