Gecho

The gecho programming language is often referred to without a capital 'g', and was created by Max Bernstein (User:Tekknolagi) in summer of 2011. 
== Inspiration ==
This language was inspired by Forth. It is stack-based.
== Naming ==
This language was named after a typo by the author. He "meant to type 'echo' but wrote a 'g' in front by accident."
== Commands ==
NOTE: gecho does not by default display the result of the operation! One must use `.`
+Pops two elements from the stack, adds them together, and pushes the result.
++Pops all the elements from the stack and adds them together; pushes result.
.Prints the top element in the stack.
*Pops two elements from the stack, multiplies them, and pushes the result.
delsPops all elements from the stack.
showPretty prints the stack.
dupPushes a copy of the top element of the stack.
swapPops two elements from the stack, and pushes back in each other's places.
-Pops two elements from the stack, subtracts the upper from the lower, and pushes the result.
jumpPops an element from the stack (a) and prints stack[a]
rangePops two elements from the stack (a, b) and prints range(b, a); starts at b, increments by one until a, pushes the array onto the stack.
[num]Pushes `num` to the stack.
**Pops all the elements from the stack and multiplies them; pushes result.
![tapeindex]Pop element from stack; set variables[tapeindex] to popped value.
&[tapeindex]Push variables[tapeindex] to the stack.
wovera = pop(); b = pop(); push(b); push(a); push(b); ( a1 a2 -- a1 a2 a1)
dropPop top element from stack, show value.
popsee `drop`
topPush the index of the top of the stack to the stack.
outasciiPop top element of stack and print ASCII character that corresponds to decimal.
printPop all elements of stack and prints ASCII characters that correspond to decimal.
/Pop top two elements from stack; divide lower element by upper element.
@[mode]Toggles mode specified.
modePrints a list of all enabled modes.
modesPrints all modes, complete with 'enabled' flag.
totFor use with @tracker. Prints number of commands so far. Does not count as a command.
resetResets the command count. For use with @tracker. Does not count as a command.
tanPops one element from the stack (degrees!) computes tan(x)
sinPops one element from the stack and computes sin(x)
cosPops one element from the stack and computes cos(x)
powa = pop(); b = pop(); push(b^a);
moda = pop(); b = pop(); push(b%a);
readReads user input. Only really useful with file reading/compiling. Pops one element from the stack and reads that number of numbers, and pushes them to the stack.
<b = pop(); a = pop(); push(a < b);
>a > b
>=a >= b
<=a <= b
=a == b
'[word]Push each character of <word> onto the stack.
<>Push ' ' to the stack.
andPush a && b to the stack.
orPush a || b to the stack.
nilDoes absolutely nothing.
nextCycles through the stacks. If on stack 1, will move to stack 2.
backDoes the opposite of `next`.
mvMoves the top element from the current stack to the next stack. To COPY, use `dup mv`.
== Turing completeness ==
It is not yet Turing complete.
== Examples ==
=== Hello World ===
'Hello, <> 'world! print
=== Limited Fibonacci ===
0 1 dup wover + dup wover + dup wover + dup wover +
=== Factorial ===
5 1 range **
Pushes the numbers 1 through 5 onto the stack, and then multiplies them all.
=== Multiple Stacks ===
1 2 + show next 3 4 + show
Computes 1+2, shows it, moves to the next stack, computes 3+4, and shows it.
See `mv` on how to exchange information between stacks.
== Future Syntax ==
=== Loops ===
5 0 [ i ]
This pushes 5 and 0 to the stack, and then iterates from 0 to 5. `i` pushes the counter to the data stack each iteration.
Fibonacci in a loop:
0 1 10 0 [ dup wover + ]
Iterates from 1 to ten, calculating 10 fibonacci numbers.
=== If Statements ===
if { 2 3 < ; 1 + ; 1 - }
If `2<3`, it adds one to the top of the stack. Otherwise, it subtracts one.
=== Function definitions ===
@sayhi { 'hello <> 'world print }
Stores the body into the function `sayhi` and whenever `*sayhi` is seen, it calls `sayhi`. Uses the stack for arguments.
@add { + }
Takes two arguments from the stack, adds them, and pushes the result.
== Implementations ==
=== Downloadable ===
Its original implementation (and current implementation) can be found here.
=== Online Interpreter ===
One can experiment with gecho in an online interpreter here.
Category:Languages
Category:2011
Category:Implemented
Category:Stack-based
Category:Total