We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

NANDlang

From Esolang
Jump to navigation Jump to search
Not to be confused with NAND, NANDNZ, nor NANDlang+.

NANDlang is a logic gate-centric and tick-based (not referring to Tick the esolang, the crazy man himself meant tick as in time) esolang that was made by a self-proclaimed crazy man named User:A random guy which fun fact, likes Huggbees and Kasane Teto, but that is completely unrelated so this does not need to be explained further. This programming language was made to compete with COW as one of the worst esolangs to code in out there, mainly due to something you will see later. This esolang is ALMOST turing complete as it does fulfill every requirement, being that it can create a clock, make programs that have memory, and have the same abilities that logic gates have. Issue? Despite it being able to have memory, it is bounded. Which thus makes this program not Turing Complete, but instead a Bounded Memory Functionally Complete program that as previously stated, is near Turing Complete. Also NANDlang does have a similar concept to NAND, being that it goes like “Hmm… What if we literally make a program that is centered around literal NAND gates?” but it is mostly different. Now, if you want a Turing Complete version of NANDlang, go visit NANDlang+.

Here is what a NAND gate is for those living under some random rock in Arizona.

NAND Gate Truth Table
Input1 Input2 Output
0 0 1
0 1 1
1 0 1
1 1 0

The Absolutely Brain Discombobulating Basics of NANDlang (Or TABDBN for short because why not?)

NANDlang as the name implies, practically only uses modified NAND gates and a way to toggle on or off ticking. Let's go over everything you need to know about such a topic, which there is plenty:

Command/Instruction Description
NAND(Input1, Input2, 1st Output Connection (Optional);2nd Output Connection (Optional)… nth Output Connection (Optional), Force Print (True/False))_(Order of Printing if there is no Output Connection) This absolute monstrosity of a modified NAND gate that will be explained later.
T set to (True/False) Allows you to set it to either be instantaneous for how booleans transfer from one NAND gate to another, or be in ticks.
Set tick speed to (Number) Makes 1 tick equal (number) milliseconds. Only used if T is set to true.
Connection Type Description
(A-Z)(Number) How you literally format wires.
(Number) How you literally format switches.

Also, # means a comment, just like in Python.

What the diddly darn hell was all of that?! That might put me in Wikipedia's Unusual Deaths of the 21st Century because of the fact that I almost got a brain aneurysm!

You might be asking that if you are Huggbees or a Huggbees fan trying to understand the literal first part of the Commands/Instructions. Which honestly, I get it, the NAND instruction is... quite a mess isn't it?

Let's break that son of a diddly darn Frankenstein abomination down shall we?

Part of NAND instruction Description
Input1, Input2. What in the world do you think when you see that? The literal 2 inputs for a NAND gate that is all it is.
(number)th Output Connection This is used to connect a NAND instruction's output to a input using wires
Force Print When this is true, it forces the NAND instruction to print out it's output, which is false by default if there is Output Connections and you don't need to type in "false" if there is no Output Connections.
_(Order of Printing if there is no Output Connection) This just straight up yells at NANDlang: "HEY YA BLIND MATE, MAKE THIS BE AT THIS PRIORITY WHEN YOU PRINT IT!" which is basically saying to print this at (blank) place. (Basically like 1, 2, 3...) And so NANDlang reluctantly in a absolutely horrified manner, obliges. Except NANDlang doesn't have feelings since it is a esolang so of course it is heartless and doesn't have morals, and the instruction isn't straight up yelling and berating NANDlang.

B-But A random guy! What about the rules?!

First of all, do not give me that tone dude what in the world man? And second, here they are since you want them so bad.

  1. Do NOT leave a wire hanging (open), they will become sad thinking that you abandoned them. (Jk it would just make a error as it wouldn't know where to connect the wire)
  2. Do NOT have multiple wires share the same name, there can only be 2 instances (for input and output) as if there is more than that, NANDlang will get confused on why there is multiple of the same wire and be in the same situation as that Spider-man Pointing meme.
  3. You can have as many instances of the switches as you want, as those instances just mean that "Hey! Switch (number) is connected to this input!" But obviously, they cannot be connected to a output.

Also, what would usually be called a program, is called a "Circuit" here.

And that's it! I hope you didn't have a brain aneurysm midway through which if you metaphorically did, then CAREFULLY (not in HowtoBasic style, you know that) reread all of this again, and if you literally, get to the hospital bro why are you reading this?


Seriously that's it for this section.



What you thought that there was anything else? That's it.

Important lines of code in NANDlang!

True:

T set to False

NAND(1,1,A1)
NAND(1,A1)

False:

T set to False

NAND(1,1,A1)
NAND(1,A1,B1)
NAND(B1,B1)

Buffer (Which is funnily enough, a binary version of a One TimeCat Program, where it outputs whatever you input. Meaning yes, this literally is the start of making a cat program in this thing.):

T set to False

NAND(1,1,A1)
NAND(A1,A1)

NOT Gate:

T set to False

NAND(1,1)

AND Gate:

T set to False

NAND(1,2,A1)
NAND(A1,A1)

OR Gate:

T set to False

NAND(1,1,A1)
NAND(2,2,B1)
NAND(A1,B1)

XOR Gate:

T set to False

NAND(1,2,A1)
NAND(1,A1,B1)
NAND(2,A1,C1)
NAND(B1,C1)

NOR Gate:

T set to False

NAND(1,1,A1)
NAND(2,2,B1)
NAND(A1,B1,C1)
NAND(C1,C1)

XNOR/XAND Gate:

T set to False

NAND(1,2,A1)
NAND(1,A1,B1)
NAND(2,A1,C1)
NAND(B1,C1,D1)
NAND(D1,D1)

Clock:

T set to True
Set tick speed to (Any number)

NAND(B1,B1,A1,True)
NAND(A1,A1,B1,True)

S-R Latch:

T set to False

NAND(1,1,A1)
NAND(H1,H1,B1)
NAND(A1,B1,C1)
NAND(C1,C1;D1)
NAND(1,1,E1)
NAND(D1,D1,F1)
NAND(E1,F1,G1)
NAND(G1,G1;H1)

D-Latch (With Comments):

T set to False

#NOT:
NAND(1,1, A1)

#AND1
NAND(1,2,B1)
NAND(B1,B1,C1)

#AND2
NAND(A1,2,D1)
NAND(D1,D1,E1)

#NOR1

NAND(C1,C1,F1)
NAND(N1,N1,G1)
NAND(F1,G1,H1)
NAND(H1,H1,I1;J1)

#NOR2

NAND(E1,E1,K1)
NAND(I1,I1,L1)
NAND(K1,L1,M1)
NAND(M1,M1,N1;O1)


D-Latch (Without Comments):

T set to False

NAND(1,1,A1)
NAND(1,2,B1)
NAND(B1,B1,C1)
NAND(A1,2,D1)
NAND(D1,D1,E1)
NAND(C1,C1,F1)
NAND(N1,N1,G1)
NAND(F1,G1,H1)
NAND(H1,H1,I1;J1)
NAND(E1,E1,K1)
NAND(I1,I1,L1)
NAND(K1,L1,M1)
NAND(M1,M1,N1;O1)

D Flip-Flop (With Comments):

T set to True
Set tick speed to (Any number)

#NOT1:
NAND(1,1,A1)

#AND1
NAND(1,U1,B1)
NAND(B1,B1,C1)

#AND2
NAND(A1,U1,D1)
NAND(D1,D1,E1)

#NOR1

NAND(C1,C1,F1)
NAND(N1,N1,G1)
NAND(F1,G1,H1)
NAND(H1,H1,I1)

#NOR2

NAND(E1,E1,K1)
NAND(I1,I1,L1)
NAND(K1,L1,M1)
NAND(M1,M1,N1;O1;P1;S1)

#CLOCK
NAND(R1,R1,Q1)
NAND(Q1,Q1,R1;J2)

#BUFFER
NAND(J2,J2,S1;U1)
NAND(S1,S1,T1;V1)

#NOT2
NAND(P1,P1,W1)

#AND3
NAND(O1,V1,X1)
NAND(X1,X1,Y1)

#AND4
NAND(W1,V1,Z1)
NAND(Z1,Z1,A2)

#NOR3
NAND(Y1,Y1,B2)
NAND(I2,I2,C2)
NAND(B2,C2,D2)
NAND(D2,D2,E2)

#NOR4
NAND(A2,A2,F2)
NAND(E2,E2,G2)
NAND(F2,G2,H2)
NAND(H2,H2,I2)

D Flip-Flop:

T set to True
Set tick speed to (Any number)

NAND(1,1,A1)
NAND(1,U1,B1)
NAND(B1,B1,C1)
NAND(A1,U1,D1)
NAND(D1,D1,E1)
NAND(C1,C1,F1)
NAND(N1,N1,G1)
NAND(F1,G1,H1)
NAND(H1,H1,I1)
NAND(E1,E1,K1)
NAND(I1,I1,L1)
NAND(K1,L1,M1)
NAND(M1,M1,N1;O1;P1;S1)
NAND(R1,R1,Q1)
NAND(Q1,Q1,R1;S1)
NAND(2,2,S1;U1)
NAND(S1,S1,T1;V1)
NAND(P1,P1,W1)
NAND(O1,V1,X1)
NAND(X1,X1,Y1)
NAND(W1,V1,Z1)
NAND(Z1,Z1,A2)
NAND(Y1,Y1,B2)
NAND(I2,I2,C2)
NAND(B2,C2,D2)
NAND(D2,D2,E2)
NAND(A2,A2,F2)
NAND(E2,E2,G2)
NAND(F2,G2,H2)
NAND(H2,H2,I2)

T Flip-Flop (Comments):

T set to True
Set tick speed to (Any number)

#CLOCK
NAND(B1,B1,A1)
NAND(A1,A1,B1;C1)

#3-AND1
NAND(1,Q1,D1)
NAND(D1,D1,E1)
NAND(E1,C1,F1)
NAND(F1,F1,G1)

#3-AND2
NAND(1,M1,H1)
NAND(H1,H1,I1)
NAND(I1,C1,J1)
NAND(J1,J1,K1)

#SR Latch
NAND(1,1,L1)
NAND(S1,S1,M1)
NAND(L1,M1,N1)
NAND(N1,N1,O1)
NAND(1,1,P1)
NAND(O1,O1,Q1)
NAND(P1,Q1,R1)
NAND(R1,R1,S1)

T Flip-Flop (No Comments):

T set to True
Set tick speed to (Any number)

NAND(B1,B1,A1)
NAND(A1,A1,B1;C1)
NAND(1,Q1,D1)
NAND(D1,D1,E1)
NAND(E1,C1,F1)
NAND(F1,F1,G1)
NAND(1,M1,H1)
NAND(H1,H1,I1)
NAND(I1,C1,J1)
NAND(J1,J1,K1)
NAND(1,1,L1)
NAND(S1,S1,M1)
NAND(L1,M1,N1)
NAND(N1,N1,O1)
NAND(1,1,P1)
NAND(O1,O1,Q1)
NAND(P1,Q1,R1)
NAND(R1,R1,S1)

4 Bit Counter (Comments)

T set to True
Set tick speed to (Any number)
#CLOCK
NAND(B1,B1,A1)
NAND(A1,A1,B1;C1)


#True Constant
NAND(1,1,D1)
NAND(1,D1)


#T Flip-Flop 1 
NAND(D1,S1,E1)
NAND(E1,E1,F1)
NAND(F1,C1,G1)
NAND(G1,G1,H1)
NAND(D1,N1,I1)
NAND(I1,I1,J1)
NAND(J1,C1,K1)
NAND(K1,K1,L1)
NAND(D1,D1,M1)
NAND(T1,T1,N1)
NAND(M1,N1,O1)
NAND(O1,O1,P1;Q1)
NAND(D1,D1,R1)
NAND(R1,R1,S1)
NAND(R1,S1,T1)
NAND(T1,T1,U1;V1)

#T Flip-Flop 2
NAND(D1,K2,W1)
NAND(W1,W1,X1)
NAND(X1,V1,Y1)
NAND(Y1,Y1,Z1)
NAND(D1,F2,A2)
NAND(A2,A2,B2)
NAND(B2,V1,C2)
NAND(C2,C2,D2)
NAND(D1,D1,E2)
NAND(L2,L2,F2)
NAND(E2,F2,G2)
NAND(G2,G2,H2;I2)
NAND(D1,D1,J2)
NAND(J2,J2,K2)
NAND(J2,K2,L2)
NAND(L2,L2,M2;N2)

#T Flip-Flop 3
NAND(D1,C3,O2)
NAND(O2,O2,P2)
NAND(P2,N2,Q2)
NAND(Q2,Q2,R2)
NAND(D1,X2,S2)
NAND(S2,S2,T2)
NAND(T2,N2,U2)
NAND(U2,U2,V2)
NAND(D1,D1,W2)
NAND(D3,D3,X2)
NAND(W2,X2,Y2)
NAND(Y2,Y2,Z2;A3)
NAND(D1,D1,B3)
NAND(B3,B3,C3)
NAND(B3,C3,D3)
NAND(D3,D3,E3;F3)

#T Flip-Flop 4
NAND(D1,U3,G3)
NAND(G3,G3,H3)
NAND(H3,F3,I3)
NAND(I3,I3,J3)
NAND(D1,P3,K3)
NAND(K3,K3,L3)
NAND(L3,F3,M3)
NAND(M3,M3,N3)
NAND(D1,D1,O3)
NAND(V3,V3,P3)
NAND(O3,P3,Q3)
NAND(Q3,Q3,R3;S3)
NAND(D1,D1,T3)
NAND(T3,T3,U3)
NAND(T3,U3,V3)
NAND(V3,V3,W3)

4 Bit Counter (No comments):

T is set to True
Set Tick Speed to (Any speed)

NAND(B1,B1,A1)
NAND(A1,A1,B1;C1)
NAND(1,1,D1)
NAND(1,D1)
NAND(D1,S1,E1)
NAND(E1,E1,F1)
NAND(F1,C1,G1)
NAND(G1,G1,H1)
NAND(D1,N1,I1)
NAND(I1,I1,J1)
NAND(J1,C1,K1)
NAND(K1,K1,L1)
NAND(D1,D1,M1)
NAND(T1,T1,N1)
NAND(M1,N1,O1)
NAND(O1,O1,P1;Q1)
NAND(D1,D1,R1)
NAND(R1,R1,S1)
NAND(R1,S1,T1)
NAND(T1,T1,U1;V1)
NAND(D1,K2,W1)
NAND(W1,W1,X1)
NAND(X1,V1,Y1)
NAND(Y1,Y1,Z1)
NAND(D1,F2,A2)
NAND(A2,A2,B2)
NAND(B2,V1,C2)
NAND(C2,C2,D2)
NAND(D1,D1,E2)
NAND(L2,L2,F2)
NAND(E2,F2,G2)
NAND(G2,G2,H2;I2)
NAND(D1,D1,J2)
NAND(J2,J2,K2)
NAND(J2,K2,L2)
NAND(L2,L2,M2;N2)
NAND(D1,C3,O2)
NAND(O2,O2,P2)
NAND(P2,N2,Q2)
NAND(Q2,Q2,R2)
NAND(D1,X2,S2)
NAND(S2,S2,T2)
NAND(T2,N2,U2)
NAND(U2,U2,V2)
NAND(D1,D1,W2)
NAND(D3,D3,X2)
NAND(W2,X2,Y2)
NAND(Y2,Y2,Z2;A3)
NAND(D1,D1,B3)
NAND(B3,B3,C3)
NAND(B3,C3,D3)
NAND(D3,D3,E3;F3)
NAND(D1,U3,G3)
NAND(G3,G3,H3)
NAND(H3,F3,I3)
NAND(I3,I3,J3)
NAND(D1,P3,K3)
NAND(K3,K3,L3)
NAND(L3,F3,M3)
NAND(M3,M3,N3)
NAND(D1,D1,O3)
NAND(V3,V3,P3)
NAND(O3,P3,Q3)
NAND(Q3,Q3,R3;S3)
NAND(D1,D1,T3)
NAND(T3,T3,U3)
NAND(T3,U3,V3)
NAND(V3,V3,W3)


4 to 1 Mulitplexer (Comments):

T set to False

#NAND
NAND(1,1,A1;B1)
NAND(2,2,C1;D1)

#3-NAND1
NAND(3,C1,E1)
NAND(E1,E1,F1)
NAND(F1,A1,G1)

#3-NAND2
NAND(4,D1,H1)
NAND(H1,H1,I1)
NAND(I1,1,J1)

#3-NAND3
NAND(5,C1,K1)
NAND(K1,K1,L1)
NAND(L1,2,M1)

#3-NAND4
NAND(6,2,N1)
NAND(N1,N1,O1)
NAND(O1,1,P1)

#4-NAND
NAND(G1,J1,Q1)
NAND(M1,P1,R1)
NAND(Q1,R1)

4 to 1 Mulitplexer (No Comments):

T set to False

NAND(1,1,A1;B1)
NAND(2,2,C1;D1)
NAND(3,C1,E1)
NAND(E1,E1,F1)
NAND(F1,A1,G1)
NAND(4,D1,H1)
NAND(H1,H1,I1)
NAND(I1,1,J1)
NAND(5,C1,K1)
NAND(K1,K1,L1)
NAND(L1,2,M1)
NAND(6,2,N1)
NAND(N1,N1,O1)
NAND(O1,1,P1)
NAND(G1,J1,Q1)
NAND(M1,P1,R1)
NAND(Q1,R1)

16 to 1 Multiplexer (Comments):

T set to False

#4 to 1 Mult 1
#NAND
NAND(1,1,A1;B1)
NAND(2,2,C1;D1)

#3-NAND1
NAND(3,C1,E1)
NAND(E1,E1,F1)
NAND(F1,A1,G1)

#3-NAND2
NAND(4,D1,H1)
NAND(H1,H1,I1)
NAND(I1,1,J1)

#3-NAND3
NAND(5,C1,K1)
NAND(K1,K1,L1)
NAND(L1,2,M1)

#3-NAND4
NAND(6,2,N1)
NAND(N1,N1,O1)
NAND(O1,1,P1)

#4-NAND
NAND(G1,J1,Q1)
NAND(M1,P1,R1)
NAND(Q1,R1,S1)


#4 to 1 Mult 2
#NAND
NAND(7,7,T1;U1)
NAND(8,8,V1;W1)

#3-NAND1
NAND(9,V1,X1)
NAND(X1,X1,Y1)
NAND(Y1,T1,Z1)

#3-NAND2
NAND(10,W1,A2)
NAND(A2,A2,B2)
NAND(B2,7,C2)

#3-NAND3
NAND(11,V1,D2)
NAND(D2,D2,E2)
NAND(E2,8,F2)

#3-NAND4
NAND(12,8,G2)
NAND(G2,G2,H2)
NAND(H2,7,I2)

#4-NAND
NAND(Z1,C2,J2)
NAND(F2,I2,K2)
NAND(J2,K2,L2)


#4 to 1 Mult 3
#NAND
NAND(19,19,M2;N2)
NAND(20,20,O2;P2)

#3-NAND1
NAND(21,O2,Q2)
NAND(Q2,Q2,R2)
NAND(R2,M2,S2)

#3-NAND2
NAND(22,P2,T2)
NAND(T2,T2,U2)
NAND(U2,19,V2)

#3-NAND3
NAND(23,O2,W2)
NAND(W2,W2,X2)
NAND(X2,20,Y2)

#3-NAND4
NAND(24,20,Z2)
NAND(Z2,Z2,A3)
NAND(A3,19,B3)

#4-NAND
NAND(S2,V2,C3)
NAND(Y2,B3,D3)
NAND(C3,D3,E3)

#4 to 1 Mult 4
#NAND
NAND(25,25,F3;G3)
NAND(26,26,H3;I3)

#3-NAND1
NAND(27,H3,J3)
NAND(J3,J3,K3)
NAND(K3,F3,L3)

#3-NAND2
NAND(28,I3,M3)
NAND(M3,M3,N3)
NAND(N3,25,O3)

#3-NAND3
NAND(29,H3,P3)
NAND(P3,P3,Q3)
NAND(Q3,26,R3)

#3-NAND4
NAND(30,26,S3)
NAND(S3,S3,T3)
NAND(T3,25,U3)

#4-NAND
NAND(L3,O3,V3)
NAND(R3,U3,W3)
NAND(V3,W3,X3)


#4 to 1 Mult 5
#NAND
NAND(31,31,Y3;Z3)
NAND(32,32,A4;B4)

#3-NAND1
NAND(S1,A4,C4)
NAND(C4,C4,D4)
NAND(D4,Y3,E4)

#3-NAND2
NAND(I2,B4,F4)
NAND(F4,F4,G4)
NAND(G4,31,H4)

#3-NAND3
NAND(E3,A4,I4)
NAND(I4,I4,J4)
NAND(J4,32,K4)

#3-NAND4
NAND(X3,32,L4)
NAND(L4,L4,M4)
NAND(M4,31,N4)

#4-NAND
NAND(E4,H4,O4)
NAND(K4,N4,P4)
NAND(O4,P4)


16 to 1 Multiplexer (No Comments):

T set to False

NAND(1,1,A1;B1)
NAND(2,2,C1;D1)
NAND(3,C1,E1)
NAND(E1,E1,F1)
NAND(F1,A1,G1)
NAND(4,D1,H1)
NAND(H1,H1,I1)
NAND(I1,1,J1)
NAND(5,C1,K1)
NAND(K1,K1,L1)
NAND(L1,2,M1)
NAND(6,2,N1)
NAND(N1,N1,O1)
NAND(O1,1,P1)
NAND(G1,J1,Q1)
NAND(M1,P1,R1)
NAND(Q1,R1,S1)
NAND(7,7,T1;U1)
NAND(8,8,V1;W1)
NAND(9,V1,X1)
NAND(X1,X1,Y1)
NAND(Y1,T1,Z1)
NAND(10,W1,A2)
NAND(A2,A2,B2)
NAND(B2,7,C2)
NAND(11,V1,D2)
NAND(D2,D2,E2)
NAND(E2,8,F2)
NAND(12,8,G2)
NAND(G2,G2,H2)
NAND(H2,7,I2)
NAND(Z1,C2,J2)
NAND(F2,I2,K2)
NAND(J2,K2,L2)
NAND(19,19,M2;N2)
NAND(20,20,O2;P2)
NAND(21,O2,Q2)
NAND(Q2,Q2,R2)
NAND(R2,M2,S2)
NAND(22,P2,T2)
NAND(T2,T2,U2)
NAND(U2,19,V2)
NAND(23,O2,W2)
NAND(W2,W2,X2)
NAND(X2,20,Y2)
NAND(24,20,Z2)
NAND(Z2,Z2,A3)
NAND(A3,19,B3)
NAND(S2,V2,C3)
NAND(Y2,B3,D3)
NAND(C3,D3,E3)
NAND(25,25,F3;G3)
NAND(26,26,H3;I3)
NAND(27,H3,J3)
NAND(J3,J3,K3)
NAND(K3,F3,L3)
NAND(28,I3,M3)
NAND(M3,M3,N3)
NAND(N3,25,O3)
NAND(29,H3,P3)
NAND(P3,P3,Q3)
NAND(Q3,26,R3)
NAND(30,26,S3)
NAND(S3,S3,T3)
NAND(T3,25,U3)
NAND(L3,O3,V3)
NAND(R3,U3,W3)
NAND(V3,W3,X3)
NAND(31,31,Y3;Z3)
NAND(32,32,A4;B4)
NAND(S1,A4,C4)
NAND(C4,C4,D4)
NAND(D4,Y3,E4)
NAND(I2,B4,F4)
NAND(F4,F4,G4)
NAND(G4,31,H4)
NAND(E3,A4,I4)
NAND(I4,I4,J4)
NAND(J4,32,K4)
NAND(X3,32,L4)
NAND(L4,L4,M4)
NAND(M4,31,N4)
NAND(E4,H4,O4)
NAND(K4,N4,P4)
NAND(O4,P4)

Hello World:

Go to this Hello World Circuit to view the absolute monstrosity of a circuit.