诗
诗 is an esolang invented by User:None1, it is based on Poetic. Programs in this esolang are like abstract Chinese poetry.
Overview
The sole form of data storage in Poetic is the unsigned byte (i.e. an integer in the range 0-255). 诗 has a "tape" of 30,000 of these unsigned bytes, and a memory pointer to keep track of which value is currently being accessed.
Source code for 诗 is entered in the form of lines. Words are considered to consist of any number Chinese characters (punctuations aren't included), and any character that is not either of these do not delimit lines or add to the character count. Each word is then converted to numbers as follows:
- If a line is less than 10 characters long, it is converted to that single digit.
- If a word is exactly 10 characters long, it is converted to the digit
0
. - If a word is more than 10 characters long, it is converted to a series of digits, representing the number as written in decimal notation (for example, a 12-letter word becomes
12
).
Each digit then turns into an instruction, and then the program is executed. The list of instructions is as follows:
Value | Brainfuck Equivalent | Description |
---|---|---|
1 | [ |
If the current byte is equal to 0, jump execution to after the matching 2 .
|
2 | ] |
If the current byte is not equal to 0, jump execution to the matching 1 .
|
3 | + |
Increment the value of the current byte by next_digit. If next_digit is 0, the value used instead is 10. |
4 | - |
Decrement the value of the current byte by next_digit. If next_digit is 0, the value used instead is 10. |
5 | > |
Increment the memory pointer by next_digit. If next_digit is 0, the value used instead is 10. |
6 | < |
Decrement the memory pointer by next_digit. If next_digit is 0, the value used instead is 10. |
7 | . |
Output the value of the current byte as an ASCII character. |
8 | , |
Read a character from the input stream, and write its ASCII value to the current byte. (Note: This sets current byte to 0 upon end of input.) |
9 | N/A | Set the current byte to a random value from 0 to 255. |
0 | N/A | End program execution here. This does not end program execution if it is used as an argument for 3 , 4 , 5 , or 6 .
|
Both the values of bytes and the memory pointer wrap around on overflow and underflow.
Examples
Cat program
一加一不等于十二 二 加二不等于十四 三加三不等于十六 没了
Hello, World!
你好世 界你好世界你好世界你 好 世界你好世 界 你好世 界你好世界你好 世界你好世 界 你好世 界你好世界你好世界你 好世界你好 世 界你好 世界你 好世界你好 世 界你好 世界你好世界你好世 界你好世界 你 好世界 你 好世界你好世 界你好世界 你好世界 你 好世 界你好世界 你 好世界 你好 世界你好世界你 好世界你好 世 界你好 世 界你好世界你好 世界你 好世界你好世界 你好世界你好世 界你好世界你好 世界你 好世界 你好世界你好世 界你好世界 你 好世界 你好 世界你好世界你 好世界你好 世 界你好世 界你好 世界你好世界你 好世界你好世 界你 好世界你好世界 你好世 界你好 世界你好世界你 好世界你 好世界你好世 界你好世界你好 世界你好 世界你好世界你好 世界你好世界你 好世界你好 世 界你好 世 界你好世界你好 世界你好世 界你 好世界你好世界 你好世界你好世界你好