esolang

LogicGates

Sixteen letters, one for every gate with two inputs, and a single bit to hold the answer.

None1, 2025 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: 1111

The idea

None1 made LogicGates in 2025. There are exactly 16 functions from two bits to one bit, and LogicGates gives each a letter. The first input is always a one-bit accumulator and the second is the cell under a pointer on a tape of bits. A capital letter writes the answer to the accumulator, the same letter in lower case writes it to the cell. Add brainfuck's moves and loops and the specification shows that every command of Boolfuck can be built, so it is Turing complete.

The machine

Gate00 01 10 11Is
A0 0 0 0False
B0 0 0 1AND
D F0 0 1 1, 0 1 0 1the accumulator, the cell
G0 1 1 0XOR
H0 1 1 1OR
N L1 1 0 0, 1 0 1 0NOT accumulator, NOT cell
Q J1 1 1 0, 1 0 0 0NAND, NOR
R1 1 1 1True

The other five letters, C E K M P, fill in the rest of the table; I and O are not used.

CommandDoes
< >Move the pointer
[ ... ]Loop while the accumulator is 1
.Print the accumulator as 0 or 1
,Read a character and keep its lowest bit
( ... )A comment

Example

The XKCD random number, 4, in unary and in binary.

The XKCD random number, 4, in unary and in binary.

Expected: 100

Adding two bits. d copies the first bit into the cell, and G leaves the XOR of the second bit and the cell in the accumulator.

Expected: 0
Expected: 1

The looping counter, R[[>F]rR[.<F]A.R], never stops. It prints 10110111011110 and on, each 1 longer than the last.

Patterns it teaches

Further

LogicGates builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from LogicGates

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run logicgates -e ',N.' --input '0'
shib manual logicgates

Source

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

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

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