esolang

Fist

Four kinds of line, and the only memory is the last line of input.

Viba, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 12 known programs · Test method

Run it

Expected: Hello, world!

The idea

Viba made Fist in 2022. The name comes from "finite state", and that is all it can be. A program prints fixed text, reads a line, and jumps to a label when that line equals some text. Nothing else is ever stored, so the state of a running program is the line it is on and the last line it read. The specification calls Fist a more compact form of FakeScript, Viba's earlier language.

The machine

LineDoes
.XPrint X
?Read a line of input
X>YJump to the label Y when the last line read is X
>YJump to the label Y
:XThe label X

The program stops after its last line. In this implementation . prints no line break, and ? gives an empty line once the input has run out.

Example

The NOT gate reads one line and jumps to the label of the same name.
Expected: 0

The NOT gate reads one line and jumps to the label of the same name. Label 0 prints 1, and label 1 prints 0.

The two input gates jump once on the first bit and once more on the second, so the label the program reaches is the result. This is its XOR on 0 and 1.

Expected: 1

The specification also gives an interpreter for +-, which prints 1 for every + and 0 for every - and stops at #.

Expected: 110

Further

Also in Turing tarpits

Write your own in Run Convert a program from Fist

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run fist -e '?
.Nope.' --input 'Hello'
shib manual fist

Source

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

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

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