ಠ_ಠ

From Esolang
Jump to navigation Jump to search

The Stack

ಠ_ಠ is stack-based. If you’re unfamiliar with stack-based programming, this language is a good place to start.

Imagine the stack as a list. In stack-based programming, the code depends on the stack for values to perform operations on. For example: instead of doing 5 + 6, stack-based programming would do something like push 5 to the stack, push 6 to the stack, and add the top two numbers in the stack - or, more concisely, 5 6 +.

Line-Jumping

In addition to having a stack, ಠ_ಠ has a feature to jump to lines. This is done through conditional if-else statements. This feature is sort of like a lbl-goto feature in BASIC, but lbl is replaced by line numbers. (More on this later.)

Syntax

ಠasdfasdfasdfಠ #note how every line is wrapped with ಠ
ಠ_ಠ #newlines are added for every command

NOTE: there are no comments allowed - if you want to run this program properly, delete the comments!

Here are all reserved chars: ಠ+-*/%_|$~“()=>?@^!`. Anything inside ಠ’s that is not reserved will be evaluated as a number (if possible), or a string.

I/O

ಠ_ಠ #push input items (separated by newlines) to the stack

The last item in the stack is outputted at the end of the program. It’s the program’s only means of outputting.

Math with the Stack

ಠ+ಠ
ಠ-ಠ
ಠ*ಠ
ಠ/ಠ
ಠ%ಠ

All of these operators push the result from the top two stack items to the stack.

Usage:

ಠ5ಠ
ಠ6ಠ
ಠ+ಠ

There’s also the random operator (ಠ@ಠ), which randomly choose 0 or 1 and pushes the result to the stack.

Logic with the Stack

ಠ=ಠ #pushes 1 or 0 depending on whether the top two stack items are equal
ಠ>ಠ #pushes 1 or 0 depending on whether the top stack item is greater than the second stack item from the top

Manipulation with the Stack

ಠ$ಠ #pop the top item from the stack
ಠ~ಠ #clear the stack
ಠ`ಠ #swap the top two stack items
ಠ"ಠ #swap the top and third from top stack items
ಠ(ಠ #take the bottom stack item and move it to the top
ಠ)ಠ #take the top stack item and move it to the bottom
ಠ^ಠ #split top stack item along chars after ^ and push results to the stack
ಠ!ಠ #join the entire stack with chars after ! and push result to the stack
ಠ'ಠ #push the stack's length to the stack

Conditional Statements

ಠ?ಠ

This is the most versatile operator ever in the history of coding. Not only is it an if-else, but it is also: - A loop (think while or for). - A goto-line-x operator. - A way to stop the program. It takes the top three stack items (all numbers). If the top item is truthy, then the program goes to the line number specified by the second stack item from the top; otherwise, it goes to the line number specified by the third stack item from the top.

The Useless Operator

ಠ益ಠ

Go try it yourself.

Oh yeah, if you successfully incorporate this operator seamlessly into your code at a code-golfing challenge, then you automatically get -100000 bytes as your score. Enjoy!