esolang

Gopher

One pointer into the Unicode table, moved by powers of two. Push where it points, then print the pile.

2016 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hi

The idea

Gopher is from 2016 and was made to be like brainfuck in some ways and its own thing in others. It has no cells and no input. One pointer walks the Unicode table in steps of 1, 4, 8, 16, 32, 64 and 128 either way, and it can be doubled or halved. The specification notes that nothing resets the pointer in one step.

Read the story

Both Hello Worlds in the specification push a quote mark before the H and after the d, so they print "Hello World" with the quotes. Both work only if the pointer starts at 0.

The machine

UpDownBy
+-1
×÷4
^@8
?!16
&%32
$#64
:;128
CommandDoes
' .Double or halve the pointer
<Push the character the pointer is at
=Print the stack, bottom first

[, , and ] make a multiplication loop. The specification says the instructions before the comma are repeated a number of times that the instructions after it choose, but not how, so this implementation leaves the loop out.

Example

$^ moves the pointer to 72, H, and &+ on to 105, i.
Expected: "Hello World"

$^ moves the pointer to 72, H, and &+ on to 105, i. The 42 character Hello World starts at 34, a quote mark, doubles it to 68 and adds 4 for the H. At the end it halves 100, the d, and takes 16 away to land on the quote mark again.

The specification also lists = alone as a one character quine. With nothing pushed it prints nothing.

Further

Ideas it shows

Also in Turing tarpits

Write your own in Run Convert a program from Gopher

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: gopher.

Command line

shib run gopher -e '&++<'\''×<&÷+<^-<<×-<#!+<$@-<&@<×-<@++<@<.!<='
shib manual gopher

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/gopher.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org