Swordfish

Swordfish is a 2D language created by User:Numeri in 2013. It was based loosely off of ><>.
== Name ==
It is called Swordfish to give homage to ><> and because swordfish sounds better than tunafish (yum!), catfish (complications with the meaning of a cat program), koi (though that would be cool), or Jaws (too cheesy). The official reason for its name is that it cuts away at the unnecessary parts of ><>; in reality, Swordfish is just simpler than ><> and isn't as versatile.
== Mechanics ==
Like many two dimensional programming languages, Swordfish has a Instruction Pointer (IP) and a direction the IP travels in. In Swordfish, the IP can travel up, down, right, and left and it initializes at (0,0) heading right. If the it leaves the borders of the program, it will wrap around to the opposite side – left to right, top to bottom, and vice versa. To simplify things, each line must be the same length.
== Data Structures ==
Available to the esoteric programmer (whether I was referring to your age or your language, you'll never know!) while programming in Swordfish are the following.
* The stack, with a first-on last-off order
* The current variable (var), which can hold anything you give it!
* The register (reg), which acts as a secondary variable. It is as versatile as the var.
When a value is pushed onto the stack from the var, the var is cleared. When a value is pushed onto the stack from the reg, the reg retains its value.
== Commands ==
All commands are a single character.
Command 	Description
/ 	Mirror the current IP direction. (left↔down and right↔up)
\ 	Mirror the current IP direction. (left↔up and right↔down)
> 	Change IP direction to the right
< 	Change IP direction to the left
^ 	Change IP direction to up
v 	Change IP direction to down
| 	Mirror the current IP direction. NOP if it is up or down.
_ 	Mirror the current IP direction. NOP if it is left or right
; 	Halt the program
: 	Interpret the next character as a regular character, not a command.
! 	Skip the next command.
~ 	Push the var onto the stack. Clear the var.
@ 	Pop the top value of the stack into the var.
+ 	Add the top value on the stack to the var. This pops the stack.
- 	Subtract the top value on the stack from the var. This pops the stack.
* 	Multiply the top value on the stack with the var. This pops the stack.
<CODE>D</CODE>	Divide the top value on the stack by the var. Put the result in var. This pops the stack.
d 	Divide the var by the top value on the stack. Put the result in var. This pops the stack.
# 	Print var.
, 	NOP. Useful for space filling.
? 	Get (currently integer only) input. Place it in var.
% 	Clear var.
{ 	If the top value on the stack is false, skip the next statement. This pops the stack.
} 	If the top value on the stack is true, skip the next statement. This pops the stack.
= 	If the top value on the stack is equal to var, push true onto the stack. Otherwise, push false. This pops the stack.
[ 	Pop the stack and place the result in reg.
] 	Push value of reg onto the stack. Reg retains its value.
$ 	Sleep for the amount of time equal to var milliseconds.
Any other character is added to var. If it is an integer and var holds an integer, var = var*10 + character's value. Otherwise append it the string in var.
== Examples ==
=== Hello, World! ===
Hello, World!
 Hello:, \
 /#;,,,,,W
 \!:d:lro/
Hello, World! but more boring.
 Hello:, Worl:d:!#;
=== Triangular Numbers ===
This calculates triangular numbers, or in other words, outputs 1, 1+2, 1+2+3, 1+2+3+4, and etc.
 1~[0,,,,,v
 ]+#~500$%\
 1]+~[@,,,\
=== Cat Program ===
A cat program
 >?#v
 ^,,<
=== Truth-Machine ===
 ?~1={v%0#;
 ,,,,,%,,,,
 ,,,,,1,,,,
 ,,,,>#,,,,
 ,,,,^<,,,,
== Computational Class ==
Because a two-register Minsky Machine can be implemented in Swordfish, this language is Turing Complete. A way to see this is that every Minsky Machine can be encoded as a graph, which can then be translated to Swordfish easily.
==Interpreter==
* Common Lisp implementation of the Swordfish programming language.
Category:Languages
Category:Turing complete
Category:Two-dimensional languages
Category:Implemented
Category:2013