Gofe
Jump to navigation
Jump to search
Gofe is a golfing language. It is invented by User:None1, but anyone who would like to contribute can contribute it.
Data Storage
It has a stack, queue, tape and deque and a register, they contain floating point values of any size.
Commands
+ - < > the same as brainfuck
, input register as decimal
? input register as character
! output register as character
. output register as decimal
[CODE] while the register is not zero, do CODE.
(CODE) while the register is zero, do CODE.
{CODE} do CODE forever.
$(CODE1)(CODE2) if the register is not 0, do CODE1, otherwise CODE2.
$[CODE] if the register is not zero, do CODE.
${CODE} if the register is zero, do CODE.
s d D t q Stands for the stack top, deque front, deque back, tape pointer and queue front respectively.
&<data structure> Push the register value to the corresponding data structure (for the tape, set pointer value instead of push).
#<data structure> Pop the register value from the corresponding data structure (for the tape, set register instead of pop).
@<data structure> Pop from the corresponding data structure (for the tape, set register instead of pop) and discard it.
;<data structure> Set the register value to the corresponding data structure, but do not discard it.
A<data structure> Add the register value by the corresponding data structure.
S<data structure> Subtract the register value by the corresponding data structure.
M<data structure> Multiply the register value by the corresponding data structure.
G<data structure> Divide the register value by the corresponding data structure.
P<data structure> Power the register value by the corresponding data structure.
Q<data structure> Mod the register value by the corresponding data structure.
L Set the register value to log(10, register value).
R Set the register to a random value within [0,1).
F Set the register to integer part of it.
"<string>" Output <string>
'<string>' Output <string> and a line feed.
/x/ set register to x.
0-9 set register to corresponding one digit number.
EOF returns 0 in all input.
Examples
Hello World
"Hello World!"
Cat Program
{?!}
Alternative that terminates on EOF
![?!]
A+B Problem
,&s,As.
99 bottles of beer
+/99/[.St"bottle"${"s"}"
of beer on the wall, "At.St"bottle"${"s"}' of beer.'"Take one down and pass it around, "$(.St"bottle"${"s"}At)("no bottles")' of beer on the wall.''']'No bottles of beer on the wall, no bottles of beer''Go to the store and buy some more, 99 bottles of beer on the wall.'
Infinite counter
{+.''}
Powers of 2
++1{.''Mt}
Fibonacci
>+<{#t.>At>&t<}
This program exausts infinite memory over time.
Truth Machine
,.[.]
Dice
6&sRMs+FAt.
Factorial
,&t1&s[#sMt-&s#t].
Project Euler problem 16
/1000/&t/10/&q/2/Pt[&sQq>At<#sGqF]>#t.
Implementation
Though it is a golfing language, it is currently unimplemented. If you have an implementation, you can put it here.