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.
NAND
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
NAND is a logic gates-based esolang. It has infinitely many inputs, outputs and NAND logic gates. Why NAND? Because it is possible to create all other logic gates using only it.
Commands
| Command | Description |
|---|---|
| ..E | Create element E |
| EN.ENW | Connect element EN to element EN (W is only for NAND) |
| fN | Flip input N (0 to 1, 1 to 0) |
| pN | Print output N |
| (N | Jump past the matching ) if output N is 0 |
| N) | Jump back to the matching ( if output N is 1 |
| Operator | Description | Possible values |
|---|---|---|
| E | Element | i o n |
| N | Serial number of element | Any non-negative number |
| W | If not empty, chooses NAND's second input (by default it is first one) | 1 |
All symbols, except for p(ion)f.1234567890, are ignored and can be used as comments (so it makes sense to write all comments in the UPPERCASE). Dots outside of constructions ..E and EN.ENW, numbers without pionf() near them and brackets without number near them are ignored.
By default there is one input, one output and one NAND in the program.
Every element can be powered by only one element, but can power infinitely many other elements, so If you will try to connect input/NAND to NAND/output that is already conncted to something, previous connction will be deleted.
Examples
Prints output values of NAND truth table:
..i i0.n0 i1.n0 n0.o0 p0 f0 p0 f1 p0 f2 p0 f1 p0
NOT:
i0.n0 i0.n0 n0.o0
AND:
..i..n i0.n0 i1.n0 n0.n1 n0.n1 n1.o0
OR:
..i..n ni0.n0 i0.n0 i1.n1 i1.n1 n0.n2 n1.n2 n2.o0
NOR:
..i..n..n..n i0.n0 i0.n0 i1.n1 i1.n1 n0.n2 n1.n2 n2.n3 n2.n3 n3.o0
XOR:
..i..n..n..n..n..n i0.n0i0.n0 i1.n1i1.n1 i0.n2i1.n2 i0.n3i1.n3 n2.n4n3.n4 n4.n5n4.n5 n5.o0
XNOR:
..i..n..n..n..n i0.n0i0.n0 i1.n1i1.n1 i0.n2i1.n2 i0.n3i1.n3 n2.n4n3.n4 n4.o0
Full adder:
..i..i..o..n..n..n..n..n..n..n..n i0.n0 i1.n0 i0.n1 n0.n1 i1.n2 n0.n2 n1.n3 n2.n3 n3.n4 i2.n4 n3.n5 n4.n5 n4.n6 i2.n6 n5.n7 n6.n7 n4.n8 i2.n8 n7.o0 n8.o1
Print 8-bit ASCII values of Hello, World!:
..if1 ..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o ..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..o..0..0..0..o..o..o..o..o..o..o..o..o..o i0.o0i0.o2i0.o3i0.o5i0.o6i0.o7i0.o8i0.o11i0.o12i0.o14i0.o16i0.o19i0.o22i0.o23i0.o24i0.o27i0.o30i0.o31 i0.o32i0.o35i0.o40i0.o41i0.o43i0.o46i0.o47i0.o48i0.o49i0.o51i0.o52i0.o53i0.o54i0.o55i0.o56i0.o60i0.o64 i0.o67i0.o72i0.o76i0.o77i0.o79i0.o80i0.o83i0.o86i0.o87i0.o88i0.o91i0.o92i0.o94i0.o95i0.o96i0.o97i0.o99i0.o100i0.o101i0.o102 i1.o1i1.o4i1.o9i1.o10i1.o13i1.o15i1.o17i1.o18i1.o20i1.o21i1.o25i1.o26i1.o28i1.o29i1.o33i1.o34i1.o36i1.o37i1.o38i1.o39i1.o42 i1.o44i1.o45i1.o50i1.o57i1.o58i1.o59i1.o61i1.o62i1.o63i1.o65i1.o66i1.o68i1.o69i1.o70i1.o71i1.o73i1.o74i1.o75i1.o78i1.o81i1.o82i1.o84i1.o85i1.o89i1.o90i1.o93i1.o98i1.o103 p0p1p2p3p4p5p6p7p8p9p10p11p12p13p14p15p16p17p18p19p20p21p22p23p24p25p26p27p28p29p30p31p32p33p34p35p36p37p38p39p40p41p42 p43p44p45p46p47p48p49p50p51p52p53p54p55p56p57p58p59p60p61p62p63p64p65p66p67p68p69p70p71p72p73p74p75p76p77p78p79p80p81p82p83p84p85p86p87p88p89p90p91p92p93p94p95p96p97p98p99p100p101p102p103