User:RaiseAfloppaFan3925/Interpreters
Jump to navigation
Jump to search
My interpreters for some languages.
Hello++++
Python
User-friendly.
import sys
def hello(source):
if source.contains('Hello World'):
print('Hello World')
if __name__ == '__main__':
argv = sys.argv
if len(argv) < 2:
hello(input())
else:
file = open(sys.argv[2], 'r')
hello(file)
file.read()
RSI0
1 plane, also just a "Hello, world!" program.
{
v>v>v>v>v>v
+I$I$I$I$I$
r.#.#.#.#.#.
IHello World
I#.#.#.#.#.#
I$I$I$I$I$I$
>^>^>^>^>^>^
}
Nope.
RSI0
1 plane too.
{
v>v>v
+I$I$
r.#.#
INope.
I#.#.I
I$I$I$
>^>^>^
}
ASCII art version
+r,Iv @@@@
@@@v<@ @@@@
>IIIIIv @@@@
Iv<$@@>v @@@@
.$.# @@>v @@@@ >IIIIIIv >v>IIIv >IIIIIv@
e#oN @@>v @@@@ @>^@ @>Iv I>^ >v @>I^@ >v@@
#p#. @@>v I@@@ @@I @I@ ^< I@ @@I I@@
$.$I @@>v I@@@ @@ ># # vI ># # I$^.@@@@@@@#@@ @@@@@
IIII @@>III@# # Iv# @@@ II @@ @@@ @@@@@@@
IIII @@@@@@@ >^@@ @@@@ II@ @@ @@@@ @>I# # .v@@@@@
^<^< @@@@@@ @@@@@@@@ II@@@@@ @@@@@@@@ <@@@@
II
II
>^
Nonstraightforward
stipulate that the provision Math.random() > 0.5 qualifies {
~/dev/stdout/write/ln("Nope.");
} otherwise {
~/dev/stdout/write/ln("Nope.");
}
LOLCODE
HAI 1.3 VISIBLE "Nope." KTHXBYE
🍡Dango
(:io-input)----
eat (')(Nope.)----
頭がおかしい
please import io thank you
Programさん、please reserve source: string thank you
Programさんはsourceにioのinput()をあげる
if source == "JavaScript" then
please ioのprint("Nope.") thank you
else
please ioのprint("Nope.") thank you
end
HQ9+
Nonstraightforward
Only works in the browser because of prompt().
private radioactive immutable readonly label string: source <- prompt();
private stable mutable readwrite label int: acc <- 0;
private stable mutable readwrite label int: idx <- 0;
so long as the condition idx < source.length is still upholding, then do {
stipulate that the provision source[idx].toLowerCase() == 'h' qualifies {
~/dev/stdout/write/ln("Hello, world!");
} otherwise stipulate that the provision source[idx].toLowerCase() == 'q' qualifies {
~/dev/stdout/write/ln(source);
} otherwise stipulate that the provision source[idx] == '9' qualifies {
private stable mutable readwrite label int: bottles <- 99;
so long as the condition bottles > 2 is still upholding, then do {
~/dev/stdout/write/ln(`${bottles} bottles of beer on the wall,`);
~/dev/stdout/write/ln(`${bottles} of beer.`);
~/dev/stdout/write/ln(`Take one down, pass it around,`);
bottles--;
~/dev/stdout/write/ln(`${bottles} of beer on the wall.\n`);
}
~/dev/stdout/write/ln("2 bottles of beer on the wall,");
~/dev/stdout/write/ln("2 bottles of beer.");
~/dev/stdout/write/ln("Take one down, pass it around,");
~/dev/stdout/write/ln("1 bottle of beer on the wall.\n");
~/dev/stdout/write/ln("1 bottle of beer on the wall,");
~/dev/stdout/write/ln("1 bottle of beer.");
~/dev/stdout/write/ln("Take one down, pass it around,");
~/dev/stdout/write/ln("No bottles of beer on the wall.\n");
~/dev/stdout/write/ln("No bottles of beer on the wall,");
~/dev/stdout/write/ln("No bottles of beer.");
~/dev/stdout/write/ln("Go to the store, buy some more,");
~/dev/stdout/write/ln("99 bottles of beer on the wall.");
} otherwise stipulate that the provision source[idx].toLowerCase() == 'a' qualifies {
acc++;
~/dev/stdout/write/ln(acc);
}
idx++;
}