esolang

Gaot++

A stack language spoken by goats. Every command is a baa or a bleet, and the number of letters is the meaning.

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

Tested with 4 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: G

The idea

Gaot++ dates from 2016. There are two words. A baa pushes a number: baaaa has four a, so it pushes 3. A bleet does something, and which thing depends on how many e it has: bleet adds, bleeet subtracts, bleeeeeeeeeet prints a character.

Read the story

The pointer reads the words in order, but one bleet turns it round. Loops are built by running a stretch of code forwards and then backwards, with skips arranged so each direction does its own half.

The machine

One stack of unbounded integers. Words are separated by whitespace.

e in the bleetDoes
2, 3Add; subtract the top from the one below
4, 5, 6Skip the next word; stop; turn round
7, 8Pop and skip the next word if not 0, or if 0
9, 10Print a number, a character
11, 12Read a number, a character
13, 14, 15, 16Dup, swap, reverse the stack, bottom to top

A word that is neither, like blet, does nothing but can be skipped. The run ends at either end.

Example

Push 71 with 72 a, print it as G.

Push 71 with 72 a, print it as G.

A cat from the specification. Forwards it reads a character, skips the turn while it is not 0, prints it and skips each blet. At the end bleeeeeeeet bleeeeeet turns round, and backwards each bleeeet skips the printing so the pointer runs back to the read.

Expected: goat

Patterns it teaches

  • Camouflage: a plain stack machine where every opcode is written in unary.
  • Stack machines: there is no memory but the stack.

Further

Stack-based

Write your own in Run Convert a program from Gaot++

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run gaotpp -e 'bleeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeet
bleeeeeeeet bleeeeeet' --input '0'
shib manual gaotpp

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/gaotpp.js

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

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