Muriel
Muriel is an esoteric programming language designed by Matthew Westcott in 2001.
Etymology
The name Muriel is an acronym that stands for Monumentally Useless Re-Iterative Execution Language.
Computational model
Like SMITH, Muriel has no traditional control structures. Instead, Muriel has a command to replace the currently running Muriel program with a given string, and run that instead. This leads to a programming method where a program must quine itself in order to perform any sort of loop.
General syntax
A Muriel program consists zero or more instructions separated by ; (semicolons).
Instructions
a:0
|
Assign the integer variable a with the value 0 . Integer variables can be any lowercase letter [a-z] and value can be any integer expression.
|
A:"Foo"
|
Assign the string variable A with the value Foo . String variables can be any uppercase letter [A-Z] and value can be any string expression.
|
."Foo"
|
Output Foo . Can be any string expression.
|
@".$0"
|
Execute the Muriel program .$0 . Can be any string expression. Variables in the current program are not passed down and control does not return to the parent program on completion.
|
Expressions
If multiple expressions are chained, they are evaluated left to right. Brackets can be used to determine the order of operation ($1+1
is invalid but $(1+1)
is "2"
).
Integer
123
|
Integer literal in decimal. Can be negative. |
a
|
Value of the integer variable a . Integer variables can be any lowercase letter [a-z].
|
1+2
|
Addition of two integer expressions. |
4-2
|
Substraction. Unary minus is allowed (-x means 0-x ).
|
2*2
|
Multiplication. |
2=2
|
Equality test. 1 if true, 0 if false. |
2>1
|
Greater than test. 1 if true, 0 if false. |
2<3
|
Less than test. 1 if true, 0 if false. |
#N
|
Number represented by string expression N . Causes an error if N does not make sense as a number.
|
&N
|
Length of string N .
|
String
"Bar"
|
String literal. Valid escape sequences are \" for " , \n for new line and \\ for \ .
|
A
|
Value of the string variable A . String variables can be any uppercase letter [A-Z].
|
~
|
String received from user input. |
"X"+"Y"
|
Concatenation of two string expressions. |
$n
|
String representation of integer expression n .
|
%N,a,b
|
Substring of N , starting at character a included (first character is 0) up to b excluded. Errors if numbers are out of range or a > b .
|
|N
|
Replaces all " , \ and new lines in the string N by their respective escape sequences.
|
Computational class
There exists an interpreter for the language Bub written in Muriel. Since Bub is a small variant of Brainfuck, it ought to be possible to show through simulation and reduction that Muriel is Turing-complete as well.
Examples
Hello, world!
."Hello, world!"
99 bottles of beer
This program has been modified to fix an error from the one showed on the original page, which did not work in Chris Pressey's interpreter due to precedence issues.
b:99; A:$b+" bottle"+(%"s",0,1-(b=1))+" of beer"; .A+" on the wall,\n"+A+",\nTake one down, pass it around,\n"; b:b-1; .$b+" bottle"+(%"s",0,1-(b=1))+" of beer on the wall.\n\n"; Q:";\nA:$b+\" bottle\"+(%\"s\",0,1-(b=1))+\" of beer\";\n.A+\" on the wall,\\n\"+A+\",\\nTake one down, pass it around,\\n\";\nb:b-1;\n.$b+\" bottle\"+(%\"s\",0,1-(b=1))+\" of beer on the wall.\\n\\n\";\nQ:\""; R:"\";\nZ:\"b:\"+$b+Q+|Q+\"\\\";\\nR:\\\"\"+|R+R;\n@%Z,0,((b>0)*&Z)"; Z:"b:"+$b+Q+|Q+"\";\nR:\""+|R+R; @%Z,0,((b>0)*&Z)
Bub interpreter
The Bub program is encoded in P, which is split into blocks with w characters. The last digit of each block is 012345678
translated from <>+-,.[](end of program)
respectively, while the other digits are only used in the loop brackets as a predetermined 0-based index of the instruction to jump to.
Note that you have to give input as three digit decimal numbers since standard Muriel has no way of converting characters to their ASCII codes or checking string equality.
The program is currently set up to print "Hello World!" followed by a newline.
P:"000100120022003200420052006200720082009202360110012201320142015201620172018201920201021301170230024502510262027202820292030203120322042603400352036203720382039104030347042004320445045204620472048204920502051205250535054205520562057506160593059706110622063206420652066206720682069207960710072207320742075207610773071707900805081108220832084208520862087208820892090209120922102609400952096209720982099210011013094710201035104110521062107210821092110211121122121611401152116211721181119311471210122512321242125212651273128312931303131313231335134313531363137313831393140314131425146614431447146114721482149215021512152215321542164615601572158215921602161116231567164016521665170616831687170217121722173217421752176217721782179218051818"; M:"0 "; c:0; I:" "; d:0; A:"??????????\n??\n?????????????????? !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; w:4; N:(%P,c*w,(c*w)+w);S:(%N,w-1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0,3);M:(%M,0,d)+F+(%M,d+3,&M);\";\nQ:Q+(%G,0,&G*(#S=3));\nH:\"I:~;\";\nG:(%H,0,&H*(&I=0))+\"M:(%M,0,d)+(%I,0,3)+(%M,d+3,&M);I:(%I,3,&I);\";\nQ:Q+(%G,0,&G*(#S=4));\nG:\".(%A,l,l+1);\";\nQ:Q+(%G,0,&G*(#S=5));\nj:#(%N,0,w-1);\nG:\"c:(c*(1-(l=0)))+(\"+$j+\"*(l=0));\";\nQ:Q+(%G,0,&G*(#S=6));\nG:\"c:(c*(l=0))+(\"+$j+\"*(1-(l=0)));\";\nQ:Q+(%G,0,&G*(#S=7));\nG:\"@\\\" \\\"\";\nQ:Q+(%G,0,&G*(#S=8));\nR:\""; Z:"\";\nX:Q+R+|R+\"\\\";Z:\\\"\"+|Z+Z;\n@X"; X:Q+R+|R+"\";Z:\""+|Z+Z; @X
See also
- Smurf is an attempt to make a Turing tarpit out of Muriel.
External resources
- Muriel website (from the Wayback Machine; retrieved on 5 December 2002)
- Muriel interpreter in Perl
- Muriel in the Esoteric File Archive