Fist

From Esolang
Jump to navigation Jump to search

Fist is an esolang created by User:Viba. Its name is derived from "Finite State", as Fist is merely finite state machine equivalent. It is effectively a more compact form of their earlier esolang FakeScript.

Description

Each line is a command. The following commands exist:

Commands
Command Description
.X Outputs string X.
? Accepts input as a string.
X>Y If the previously accepted input is equal to X, jump to label Y. If X is an empty string (ie. >Y), jump to label Y unconditionally.
:X Declares a label identified as X.

The program halts after the bottom of the program is reached.

Examples

Hello, world!

.Hello, world!

Truth-machine

?
0>0
1>1
>hlt

:0
.0
>hlt

:1
.1
>1

:hlt

+ interpreter

:c
?
+>+
>c
:+
.+
>c

It is can be implemented, because it is language with only "Push" command

Nope. interpreter

?
.Nope.

Logic Gates

NOT

?
0>0
1>1
:0
.1
>end
:1
.0
:end

AND

?
0>0x
1>1x
:0x
?
1>0
0>0
:1x
?
1>1
0>0
:0
.0
>end
:1
.1
:end

OR

?
0>0x
1>1x
:0x
?
1>1
0>0
:1x
?
1>1
0>1
:0
.0
>end
:1
.1
:end

NAND

?
0>0x
1>1x
:0x
?
1>1
0>1
:1x
?
1>0
0>1
:0
.0
>end
:1
.1
:end

NOR

?
0>0x
1>1x
:0x
?
1>0
0>1
:1x
?
1>0
0>0
:0
.0
>end
:1
.1
:end

XOR

?
0>0x
1>1x
:0x
?
1>1
0>0
:1x
?
1>0
0>1
:0
.0
>end
:1
.1
:end

XNOR

?
0>0x
1>1x
:0x
?
1>0
0>1
:1x
?
1>1
0>0
:0
.0
>end
:1
.1
:end

+- interpreter

:code
?
+>+
->-
#>end
:+
.1
>code
:-
.0
>code
:end

Uses # to end the program. Counter value is numbers of 1 outputed - numbers of 0 outputed

External resources