EmojiStack
(Redirected from Mojifunge)
Mojifunge is a programming language invented by User:LEOMOK It is stack-based and uses emojis as commands. All values on the stack are arbitrary-precision integers. All characters except the 553 emojis in the codepage are ignored.
Commands
Literals ๐ - Push 0. 0๏ธโฃ1๏ธโฃ2๏ธโฃ3๏ธโฃ4๏ธโฃ5๏ธโฃ6๏ธโฃ7๏ธโฃ8๏ธโฃ9๏ธโฃ - Multiply by 10 and add corresponding digit. ๐ก - Push the next emoji's value in the codepage. ๐ค - Push the values of everything between it and the next ๐ค. Operators โ - Pop a, b, push a+b. โ - Pop a, b, push b-a. โ๏ธ - Pop a, b, push a*b. โ - Pop a, b, push b/a (integer division). ๐ฎ - Pop a, b, push b%a. ๐ผ - Pop a, b, push a**b. Negative exponents are truncated to 0. โ - Pop a, push -a. โญ - Pop a, b, push b&a. ๐ข - Pop a, b, push b|a. โ - Pop a, b, push b^a. โฃ๏ธ - Pop a, push ~a. โช - Pop a, b, push a<<b. โฉ - Pop a, b, push a>>b. ๐ - Pop a, b, push a==b (true is -1, false is 0). โ๏ธ - Pop a, b, push b<a. โถ๏ธ - Pop a, b, push b>a. Stack manipulation ๐ - Duplicate. ๐ - Drop. ๐ - Swap. ๐ - Rot. ๐ - Over. ๐ - Move to previous stack. ๐ - Move to next stack. ๐ - Reverse the stack. ๐ - Push length of stack. Control flow ๐ค๐ค - Codeblock. Used for if-statements and loops. (No codeblocks needed for single instructions) โช๏ธ - Pop a, if a != 0 then (codeblock) โคต๏ธ - Else condition in if statements. Use โคต๏ธโช๏ธ for else if. ๐ - While loop. At the end of each iteration, pop a. If a == 0, end the loop immediately. โ - Break out of loop. โฉ๏ธ - Loop continue. ๐ฉ - End program execution. Functions Anything not mentioned - If followed by a codeblock, define a function. Else, run that function. They will be run in a seperate "function stack", and the โโโโ commands will input/output to the current stack, not the standard I/O) I/O โ - Input a line, parse into arithmetic expression with +, -, *, /, %, **, &, |, ^, << and >> then push result. Error if the line cannot be parsed. โ - Input a character, push Unicode value. โ - Print top of stack, followed by a space. โ - Print top of stack as Unicode character.
Examples
Hello World:
๐คโคต๏ธ๐ฆ๐ป๐ป๐๐๐ณ๐๐๐ป๐ฏ0๏ธโฃ๐ค๐ ๐๐ค โ ๐ค ๐ฉ