Capuirequiem
Capuirequiem is an esoteric programming language by User:Zzo38 from the year 2006. All of the ASCII characters mapping to the code range 33 to 126 constitute valid content. The digits 0 to 9 as commands push their own value onto the stack. Lowercase letters and the apostrophe are valid characters to use as a part of a name. The language is stack-based and discriminates between three types: array, string, and integer.
There exists no command for comments, but this lacuna can be circumvented by defining a string of temporary duration only: Enclosing the commentary text with [ and ] and appending a Z command to immediately discard this string, the programmatically ineffectual object acts as a note to the reader without influencing the code. For example:
[This is a comment.]Z
Capuirequiem is known to be Turing-complete because Underload without output can be compiled into it; albeit there are some pathological Underload programs which produce different output after being compiled.
List of commands
| Character | Function |
|---|---|
| [0-9] | Number to stack |
| [a-z'] | Append character to end of current name |
| [] | Square brackets indicate a string, push to stack |
| A | Make new array |
| B | Integer division |
| C | Concatenate strings |
| D | Duplicate top entry of stack |
| E | Multiplies exp(a) by (b) round down |
| F | Logarithm log(a,b) rounded down |
| G | Sets pointer position of array, or modulo of 2 numbers |
| H | Calculates a to power of b |
| I | Input one byte |
| J | Position of program pointer inside of current block |
| K | Absolute value of difference |
| L | Loop if not zero, or replaces current block with a different string |
| M | Calculates which of 2 numbers is larger |
| N | Number negative one |
| O | Output one byte, or output a string, or use external add-in function of a array |
| P | Get position of pointer in array, or add brackets around a string |
| Q | Cancels the current block |
| R | Reverse the stack |
| S | Swap top 2 values of the stack |
| T | Figures out type of value at top of stack, 0=number, 1=string, 2=array |
| U | Cancel block if zero |
| V | Execute sub-routine in array using its own memory, or executes a string inline |
| W | Converts number 0-255 to string of a single character, or adds backtrack point to global stack, or retrieves backtrack point, or can just discard a number -1 (which is a dead backtrack point) |
| X | Executes a string as a separate block, or multiply 2 numbers together |
| Y | Discard second from top entry of stack |
| Z | Discard top entry from stack |
| ( | Number 100 |
| ) | Number 256 |
| " | Removes current name |
| { | Store value in a variable with given current name |
| } | Retrieve value from variable with given current name |
| @ | Skip a number of commands |
| _ | Negative value of number |
| , | Get value from array, or multiply a number by ten and add the other number |
| . | Store value in array, or subtraction of 2 numbers |
| - | Decrement |
| + | Increment |
| < | Move array pointer 1 space backwards |
| > | Move array pointer 1 space forwards |
| | | Separate number to half of it and the remainder, or split string at first character |
| = | 1 if equal, 0 if not-equal |
| ; | Recombines numbers that were separated to half and remainder |
| / | Move data to global stack |
| \ | Move data to normal stack |
| & | Bit AND of 2 numbers |
| ? | Bit XOR of 2 numbers |
| * | Bit OR of 2 numbers |
| # | Add current name to stack |
| $ | Pop a,b,s,v, push (s-v)*(a%b) |
| % | Search stack for a value according to index into stack, or search a array for a value |
| ^ | Removes a number of values from the stack |
| : | Count number of entries in the stack |
| ! | Number 10 |
Examples
Beer program
[99 bottles of beer program]Z
99"n{"m{
"b[ bottles of beer]{
"w[ on the wall]!WC{
"o[
["n}U48,"n}_KO]X
48,"m}_KO
]{
[
"o}X"b}O"w}O
"o}X"b}O!O
[Take one down, pass it around,]O!O
"m}-DN=[U"n}-"n{Z9]X"m{
10"n}"m},=KU
"o}X"b}O!O!O
1L
]X
[No more]O"b}O"w}O
Hello World program
[Hello World!]O
Cat program (forever)
IO!L
Cat program (stop at NULL)
IDOL
Reverse input (stop as NULL)
A0.>[ID"{.>"}L]X
<[<D,DOL]X
ROT13 program (forever)
[Initialze array of values 0 to 255]Z A[DP.>DP25,6,KL]X [Add 13 to value at position 65 to 77 in the array]Z 65,G[+++++++++++++>DP78,KL]X [Subtract 13 from value at position 78 to 90 in the array]Z 78,G[------------->DP91,KL]X [Add 13 to value at position 97 to 109 in the array]Z 97,G[+++++++++++++>DP11,0,KL]X [Subtract 13 from value at position 110 to 122 in the array]Z 11,0,G[------------->DP12,3,KL]X [Get values from input and transform according to ROT13]Z [IGD,O1L]X
Quine program
[91,OO93,O[DX]O]DX
Kimian quine program
ERR
Fibonacci program
[This function output a number in decimal format]Z
[
[]D/V
D /01!\$ 48,_KW\C/
!SB DL Z\O
]"n{
[Print out the fibonacci sequence]Z
[1.]O 0"a{1"b{ [
"a}"b}D"a{_KD"b{
"n}X [.]O
1L
]X
Backtracking
[These are the examples of backtracking-INTERCAL,
and they have been converted to Capuirequiem.]Z
[0]"{
[[1]"{]W
"}O
\W
!O
[0]"a{
[2]"b{
1[Z0]W[U[1]"a{]X
1[Z0]W[U[3]"b{]X
"a}O
"b}O
\W
[.]O
\W
!O
[0]"a{
[2]"b{
1[Z0]W[U[1]"a{]X
1[Z0]W[U[3]"b{]X
"a}O
"b}O
\Z
[.]O
\W
Input a Capuirequiem program ending in NULL and execute
#[IDUWC!L]XZV
Brainfuck interpreter
[ Brainfuck interpreter in Capuirequiem ]Z
[Initialize variables]Z
A+- "tape{
[] "prog{
[Load program]Z
[IDU
[Begin loop]Z
[D91,=U }91,W[},U]CC{ ]X
[End loop]Z
[D93,=U }[1L]93,W[X]CCC{ ]X
[Tape pointer left]Z
[D60,=U }[}<+-{]C{ ]X
[Tape pointer right]Z
[D62,=U }[}>+-{]C{ ]X
[Increment]Z
[D43,=U }[}+D{,[)=U}0.{]X]C{ ]X
[Decrement]Z
[D45,=U }[}-D{,[N=U})-.{]X]C{ ]X
[Input]Z
[D44,=U }[}I.{]C{ ]X
[Output]Z
[D46,=U }[},O]C{ ]X
L]X
[Execute program]Z
"prog}"tapeX