Bespoke

Bespoke is an esoteric programming language created in 2025 by Josiah Winslow. It encodes instructions into the lengths of words, similarly to his earlier esolang Poetic. Programs can tend to look like abstract poetry, although a series of instruction mnemonics are often used when developing programs to make the process easier.
==Overview==
Bespoke has both a stack and a heap for storing data. Arbitrary precision signed integers can be pushed and popped onto the stack, and the heap maps integer addresses to integer values.
Source code for Bespoke is entered in the form of words, in any natural language. Words are considered to consist of any number of alphabetic characters and apostrophes, and any character that is not either of these is ignored and treated as a delimiter. Apostrophes do not delimit words or add to the letter count. Each word is then converted to numbers as follows:
* If a word is less than 10 letters long, it is converted to that single digit.
* If a word is exactly 10 letters long, it is converted to the digit 0.
* If a word is more than 10 letters 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).
The digits are then turned into a series of instructions and executed.
==Instructions==
In addition to the necessary digit sequences for each instruction, a series of mnemonics that match the digit sequences will also be provided, for readability and ease of use.
 1: Heap storage/retrieval (H)
Digits	Mnemonic 	Description
11 	H V 	Pop addr, then push the value stored at heap address addr (0 if it doesn't exist).
13 	H LDV 	Same as 11.
15 	H LOADV 	Same as 11.
17 	H LOADVAL 	Same as 11.
19 	H LOADVALUE 	Same as 11.
12 	H SV 	Pop addr then val, then store val at heap address addr.
14 	H STRV 	Same as 12.
16 	H STOREV 	Same as 12.
18 	H STOREVAL 	Same as 12.
10 	H STOREVALUE	Same as 12.
 2: Stack manipulation (DO)
Digits	Mnemonic 	Description
21 	DO P 	Pop the top value.
22 	DO PN 	Pop n, then pop the nth value from the top.
23 	DO ROT 	Pop n, then rotate the stack by moving the top value down to the nth position.
24 	DO COPY 	Push a copy of the top value.
25 	DO COPYN 	Pop n, then push a copy of the nth value from the top.
26 	DO SWITCH 	Swap the top two values.
27 	DO SWITCHN 	Pop n, then swap the top value with the nth value from the top.
28 	DO TURNOVER 	Reverse the stack.
29 	DO TURNOVERN 	Pop n, then reverse the top n values of the stack.
20 	DO ROTINVERSE	Pop n, then rotate the stack backwards by moving the value at the nth position up to the top.
 3, 4, and 9: Pushing numbers (PUT, PUSH, and CONTINUED)
Digits	Mnemonic 	Description
3 	PUT 	Push multi-digit numbers: follow with length first (where 0 is considered 10), then digits.E.g. PUT XX:I NUMBERZERO pushes 10; PUT XXXXX:TRI BI SEVENTH SEXTET INTEIGHT pushes 32768; PUT XXXXXXXXXX:I BI TRI FOUR FIFTH SEXTET SEVENTH INTEIGHT DIGITNINE NUMBERZERO pushes 1234567890.
4 	PUSH 	Push single-digit numbers: follow with the digit to push.E.g. PUSH FOUR pushes 4; PUSH SEVENTH pushes 7; PUSH NUMBERZERO pushes 0.
9 	CONTINUED	Use immediately after a 3 (PUT), 74 (CONTROL CALL), or 78 (CONTROL FUNCTION) command to use longer multi-digit numbers.E.g. PUT XXXXXXXXXX:TRI I I TRI I BI I I I TRI; CONTINUED XXXX:I BI BI I pushes 31131211131221.
 5: Input (INPUT)
Digits	Mnemonic 	Description
51 	INPUT N 	Read input as a number and push it onto the stack.
53 	INPUT INT 	Same as 51.
55 	INPUT INTGR 	Same as 51.
57 	INPUT INTEGER 	Same as 51.
59 	INPUT INTNUMBER 	Same as 51.
52 	INPUT CH 	Read input as a character and push its Unicode codepoint value onto the stack.
54 	INPUT CHAR 	Same as 52.
56 	INPUT STRING 	Same as 52.
58 	INPUT STRINGCH 	Same as 52.
50 	INPUT STRINGCHAR	Same as 52.
 6: Output (OUTPUT)
Digits	Mnemonic 	Description
61 	OUTPUT N 	Pop n, then output n as a number.
63 	OUTPUT INT 	Same as 61.
65 	OUTPUT INTGR 	Same as 61.
67 	OUTPUT INTEGER 	Same as 61.
69 	OUTPUT INTNUMBER 	Same as 61.
62 	OUTPUT CH 	Pop n, then output n as a Unicode codepoint.
64 	OUTPUT CHAR 	Same as 62.
66 	OUTPUT STRING 	Same as 62.
68 	OUTPUT STRINGCH 	Same as 62.
60 	OUTPUT STRINGCHAR	Same as 62.
 7: Control flow (CONTROL)
Digits	Mnemonic 	Description
71 	CONTROL B 	Break out of the current loop.
72 	CONTROL IF 	Pop cond, then if cond is nonzero, run this block up to the matching 73 (CONTROL END) or 79 (CONTROL OTHERWISE), whichever comes first; otherwise, skip past the matching 73 (CONTROL END) or 79 (CONTROL OTHERWISE), whichever comes first.
73 	CONTROL END 	End this block.
74 	CONTROL CALL 	Call a function; follow with multi-digit number (the function's "name") with the same syntax as the 3 (PUT) command.E.g. CONTROL CALL XXX:PRINT SQUARE ROOT calls a function "named" 564.
75 	CONTROL WHILE 	Define a while loop block; pop cond at the start, and run this block in a loop while cond is nonzero.
76 	CONTROL RETURN 	Return from the current function.
77 	CONTROL DOWHILE 	Define a do-while loop block; pop cond at the end, and run this block in a loop while cond is nonzero.(This loop always runs without popping anything the first time through.)
78 	CONTROL FUNCTION 	Define a function block; follow with multi-digit number (the function's "name") with the same syntax as the 3 (PUT) command.E.g. CONTROL FUNCTION XXX:PRINT SQUARE ROOT defines a function "named" 564.
79 	CONTROL OTHERWISE 	See 72.
70 	CONTROL ENDPROGRAM	Immediately end program execution.
 8: Arithmetic operations (STACKTOP)
Digits	Mnemonic 	Description
81 	STACKTOP F 	Pop n, then push 1 if n is zero, and 0 otherwise.
82 	STACKTOP LT 	Pop b then a, then push 1 if a < b, and 0 otherwise.
83 	STACKTOP POW 	Pop b then a, then push a ^ b. (Negative powers get calculated as abs(b)th roots, rounded down to an integer.)
84 	STACKTOP PLUS 	Pop b then a, then push a + b.
85 	STACKTOP MINUS 	Pop b then a, then push a - b.
86 	STACKTOP MODULO 	Pop b then a, then push a % b. (The result has the same sign as b.)
87 	STACKTOP PLUSONE 	Pop n, then push n + 1.
88 	STACKTOP MINUSONE 	Pop n, then push n - 1.
89 	STACKTOP PRODUCTOF 	Pop b then a, then push a * b.
80 	STACKTOP QUOTIENTOF	Pop b then a, then push a / b (rounded down to an integer).
 0: Comments (COMMENTARY)
Digits 	Mnemonic 	Description
00 	COMMENTARY INITIALIZE / COMMENTARY TERMINATE 	Define a block comment; the digits 00 both start and end the comment.
0 ... 0	COMMENTARY ... INITIALIZE / COMMENTARY ... TERMINATE	Another way to define a block comment; any nonzero digits can go within the ..., and the same digit sequence will both start and end the comment.
==Examples==
===Hello, World!===
 more peppermint tea?
 ah yes, it's not bad
 I appreciate peppermint tea
 it's a refreshing beverage
 
 but you immediately must try the gingerbread
 I had it sometime, forever ago
 oh, and it was so good!
 made the way a gingerbread must clearly be 
 baked
 
 in fact, I've got a suggestion
 I may go outside
 to Marshal Mellow's Bakery
 so we both receive one
This corresponds to the following mnemonics:
 PUSH NUMBERZERO
 PUT XX:TRI TRI
 PUT XXX:I NUMBERZERO NUMBERZERO
 PUT XXX:I NUMBERZERO INTEIGHT
 PUT XXX:I I FOUR
 PUT XXX:I I I
 PUT XX:INTEIGHT SEVENTH
 PUT XX:TRI BI
 PUT XX:FOUR FOUR
 PUT XXX:I I I
 PUSH SEVENTH DO COPYN
 DO COPY
 PUT XXX:I NUMBERZERO I
 PUT XX:SEVENTH BI
 CONTROL DOWHILE
 OUTPUT CH
 DO COPY
 CONTROL END
===Truth machine===
 there I stumble
 falling up
 even whilst I go down
 falling out
This corresponds to the following mnemonics:
 INPUT N
 CONTROL DOWHILE
 DO COPY
 OUTPUT N
 DO COPY
 CONTROL END
===Fibonacci sequence===
Takes a number n as input, and outputs the first n Fibonacci numbers.
 read a note I wrote you
 it says "someone shall love you,
 as big as past lovers did,
 put in a collection"
 surely it will be
 in truth, somebody here is probably isolated
 existing in pain without you
This corresponds to the following mnemonics:
 PUSH I
 PUSH I
 INPUT INT
 DO COPY
 CONTROL WHILE
 PUSH TRI DO ROT
 DO COPY
 OUTPUT INT
 PUT XX:I NUMBERZERO
 OUTPUT CH
 PUSH BI DO COPYN
 STACKTOP PLUS
 DO TURNOVER
 STACKTOP MINUSONE
 DO COPY
 CONTROL END
Fun fact: the Fibonacci sequence program was the first ever Bespoke program, written when the specs weren't yet finalized.
==Implementation==
* Official Python interpreter (contains other example programs)
Category:2025 Category:Turing complete Category:Stack-based Category:Implemented Category:Languages Category:Pseudonatural