Twoface

From Esolang
Jump to navigation Jump to search

Twoface is an esoteric programming language created by user:Tastyl. Programs written in twoface are designed to look like emoticons.

Instruction Set

Face Name Description
:) push Pushes a number to the stack. The number pushed is based on how many ')'s the face has. (":))" would push a 2)
:( pop Pops the top number off of the stack.
:D add Pops the top two numbers off of the stack, and pushes the sum back on.
:o subtract Pops the top two numbers off of the stack, and pushes the difference back on. (top number - bottom number)
:O mult Pops the top two numbers off of the stack, and pushes the product back on.
:p divide Pops the top two numbers off of the stack, and pushes the quotient back on. (top number / bottom number)
:P modulo Pops the top two numbers off of the stack, divides them, and pushes the remainder back on. (top number / bottom number)
:> dup Duplicates the top number on the stack.
:< reverse Reverses the stack.
:^ equals Pops the top two numbers off of the stack, and if they are equal, skips the next n number of lines where n is the amount of '^'s in the face. (e.g. :^^^ would skip the next 3 lines)
=) not equal Works like equals, but skips lines if they are not equal. (e.g. =))) would skip the next 3 lines)
>:) greater Works like equals, but skips lines if the top number is greater than the bottom. (e.g. >:))) would skip the next 3 lines)
>:( lesser Works like equals, but skips lines if the bottom number is greater than the top. (e.g. >:((( would skip the next 3 lines)
:-) printa Pops the top number off of the stack, and prints out its ASCII value.
:-( printn Pops the top number off of the stack, and prints it out.
xD reada Reads input from the user, and pushes its ASCII value to the stack.
XD readn Reads input from the user, and if it's numeric, pushes it to the stack. If not, it ignores it.
:] goto If there are enough lines in the program, goes to the line number added. (e.g. :]]] would go to line 3)
:[ empty Empties the stack.
-_- halt Halts the program.

Example Programs

Hello world

:)))))))))
:))))))))
:O
:>
:-)
:)))))))
:))))
:O
:)
:D
:D
:>
:-)
:)))))))
:D
:>
:-)
:>
:-)
:)))
:D
:>
:-)
:)))))))))))
:))))))
:O
:)
:D
:<
:o
:>
:-)
:))))))))))))
:<
:o
:>
:-)
:)))))))))))
:)))))
:O
:D
:>
:-)
:))))))
:))))
:O
:D
:>
:-)
:)))
:D
:>
:-)
:))))))
:<
:o
:>
:-)
:))))))))
:<
:o
:>
:-)
:)))))))))))
:))))))
:O
:)
:D
:<
:o
:-)

Truth-machine

XD
:)
=)))
:)
:-(
:]]]]
:
=)))
:
:-(

External resources

Github Page and Official Interpreter