GotoFuck

From Esolang
Jump to navigation Jump to search

GotoFuck (also known as GotoF, GotoF***) is a brainfuck derivative by VilgotanL, It is identical to brainfuck except that uses a conditional goto instead of the regular while-loop.

Instructions

+ Increment the cell at the pointer
- Decrement the cell at the pointer
> Move the pointer right
< Move the pointer left
. Print the value of the cell at the pointer as an ascii character
, Take one character of input and place its ASCII code into the cell at the pointer, 0 on EOF
:n If the value of the cell at the pointer is 0, goto the line n with line numbers starting at 1, if n is omitted, invalid, or out of range, the program ends if the cell at the pointer is 0

Any other instructions are ignored.

Examples

Cat program

,:.>
:1

Hello World (slightly optimized, transpiled from brainfuck)

>>++++++:3>
<-<<++++++++++++>>:3>:2
<<.>>++++:5>
<-<<+++++++>>:5>:4
<<+.+++++++..+++.:7>
<-:7>:6
>>++++:9>
<-<<+++++++++++>>:9>:8
<<.------------.>>++++++++:11>
<-<<+++++++++++>>:11>:10
<<-.--------.+++.------.--------.:13>
<-:13>:12
>>++++:15>
<-<<++++++++>>:15>:14
<<+.:17>
<-:17>:16
++++++++++.:19>
<-:19>:18

Truth-machine

,.:3>
<->>+>>+<<<<:3>:2
++++++:5>
<->>--------<<:5>:4
>>:7>
<>>.<<:7>:6

Computational class

GotoFuck is Turing-complete since brainfuck can be transpiled to it using the following translation table:

Brainfuck GotoFuck
> >>
< <<
[
:n>
<
where n is the line number after the transpiled code of the matching ]
]
:after>:n
where after is the line number after this line, and where n is the line number after the transpiled code of the matching [, (the line with the <)

All other instructions are the same.

This can be shown in action in this transpiler.

Implementations

Interpreter by the creator

See also