<a href="https://www.khanacademy.org/computer-programming/two-dimensional-programming-language/6252487852687360">This</a> Programming Language
====================================================================================================================================================

**Factoid:** This programming language is a two-dimensional programming language closely related to<br>><> and more distantly Befunge. It is based on ><>.

**1 character**

    >

An infinite loop. Like ><> and Befunge, code will wrap around in this programming language. Note that in the interpreter, this will not result in an infinite loop as the interpreter gives up after (by default) 2048 commands.

In fact, any command but `;` when by itself in a program would result in an infinite loop.

**2 characters**

    1i

Outputs 1 indefinitely (theoretically). Any number from `0` to `9` would do pretty much the same. Note: `i` outputs the whole stack as a [non-delimited] string of numbers, `s` as a string of characters - generated from the numbers on the stack.

**3 characters**

    )s;

Finally! Something interesting! This is a `cat` program which outputs its input.

**4 characters**

    1~i;

Demonstrates the `pop` (`~`) function. Although this pushes `1` to the stack, it is popped and it outputs nothing. (Not very interesting, I know.)

**5 characters**

    'a's;

Prints `a`. This demonstrates the string parsing function: when an `'` is encountered, the rest of the characters are pushed to the stack as character codes until another `'` is encountered. This leads to the escape for `'` being quite costly: `'39&'` (Note: `&` concatenates the top two numbers on the stack [e.g. `39` --> `[3, 9]` | `39&` --> `[39]`])

**6 characters**

    123\i;

Demonstrates the right-shift function. `1`, `2`, and `3` are pushed onto the stack, then the stack is shifted right (by one position). The output of this program is `312`. `\` can be replaced with `|` (the left-shift operator) to shift the stack one position left instead of right. While this does not seem to be very interesting, it has a surprising number of applications in this programming language.

**7 characters**

    8[42i];

Yay! Stacks! This programming language, like ><> can create multiple stacks and run operations on them independent of other stacks (side note: this programming language has only *one* register and, unlike ><>, new registers are *not* created with new stacks). There are three different kinds of stacks - additive (`[`), overlap (`(`), and copy additive (`{`). Stacks are classified by their behaviours when opened and closed (`]`) or flattened (`f`). Additive stacks will be empty when open (`[]`) and will add their data to the end of the next stack when closed (i.e. `4[11+]&i;` outputs `42`). Overlap stacks will be empty when open and will add their data to the *beginning* of the next stack when closed (i.e. `4(11+]&i;` outputs `2`). Copy additive stacks are like additive stacks, but they open with the data of the next stack (i.e. `4{11+]&i;` outputs `442`). A stack trace of this program is as follows: `[8] [8][4] [8][42] [8]["42"] [842] [end]`, where `""` indicates something that is outputted.

**8 characters**

    42&"i"i;

What? Is this program not working correctly? No. As mentioned in the previous snippet, this programming language, like ><>, has a register. When the `"` command is called, if the register is empty, the top value on the stack is popped and pushed onto the register. Otherwise, the value in the register is popped and pushed onto the stack. Therefore, even though there are two `i` commands, only one outputs `42` because the other is called while `42` is in the register and not the stack.

**9 characters**

    39&'\\\s;

A quine! From all the above snippets, you have enough information to figure out how this works. The key is that string parsing wraps around in this programming language, much like all regular commands.

**Read Me**

Currently the interpreter is broken due to the addition of an infinite-loop prevention system in Khan Academy. I'm working to fix it, and once I do I will catch up with this answer!