- "Merthese" Programming Language
- 23 Jun 2011 11:19:07 am Permalink
- Last edited by merthsoft on 31 Aug 2012 10:47:16 am; edited 2 times in total
As a joke, I (with the help of Tari) made an esoteric programming language called Merthese. Here's the spec:
Edit by Tanner: Added the Merthing @ Kerm rules
I also decided to make an interpreter, called Merthterpreter, in C# (of course). Here's the code:
Code:
I clearly could've easily made this one function, but then I wouldn't've gotten to use call Merthterpret. Here's a download link:
http://merthsoft.com/Merthterpreter.exe
And here's some sample output:
Code:
Quote:
Merthese is an esoteric programming language written by Merthsoft. It has 5 instructions:
m - Prints "merth"
e - Prints a new line (defined as new line for the environment)
r - Prints a space
t - Prints a random-length string of random letters where letters are [a-z], and the length of the string is between [0, 13.4)
h - Seeks to the character after the next "h" character
All other characters are ignored. The program terminates when input ends.
m - Prints "merth"
e - Prints a new line (defined as new line for the environment)
r - Prints a space
t - Prints a random-length string of random letters where letters are [a-z], and the length of the string is between [0, 13.4)
h - Seeks to the character after the next "h" character
All other characters are ignored. The program terminates when input ends.
Edit by Tanner: Added the Merthing @ Kerm rules
Quote:
k - Print accum. char
e - accum++
r - Reset accum
m - Print accum. num
e - accum++
r - Reset accum
m - Print accum. num
I also decided to make an interpreter, called Merthterpreter, in C# (of course). Here's the code:
Code:
using System;
using System.Text;
namespace Merthterpreter {
class Merthterpreter {
static bool hFlag = false;
static Random rand = new Random();
static void Main(string[] args) {
foreach (String s in args) {
foreach (char c in s) {
Merthterpret(c);
}
}
}
private static void Merthterpret(char c) {
if (hFlag && c != 'h') {
return;
}
switch (c) {
case 'm':
Console.Write("merth");
break;
case 'e':
Console.WriteLine();
break;
case 'r':
Console.Write(" ");
break;
case 't':
int len = (int)(rand.NextDouble() * 13.4);
StringBuilder s = new StringBuilder(len);
for (int i = 0; i < len; i++) {
s.Append((char)(rand.Next((int)'a', (int)'z' + 1)));
}
Console.Write(s.ToString());
break;
case 'h':
hFlag = !hFlag;
break;
}
}
}
}
I clearly could've easily made this one function, but then I wouldn't've gotten to use call Merthterpret. Here's a download link:
http://merthsoft.com/Merthterpreter.exe
And here's some sample output:
Code:
Merthterpreter.exe merthsoft is the coolest guy in the whole entire world.
merth
ms
jrswvltxukzbgis
dhkystskhow