esolang
Learn · Ideas354 languages show it

Turing tarpit

A language that can compute anything, and makes everything painful. Universal, but stuck in the tar.

●○○ easy · where to see it

The idea

The phrase comes from Alan Perlis's Epigrams on Programming (1982). His point is that in a tarpit everything is possible, yet nothing interesting is easy.

Read the story

Perlis meant it as a warning about real languages. Esolang makers took it as a design goal. How few instructions can a language have and still be Turing complete? The answer turns out to be very few. Eight for Brainfuck, one for Subleq, two combinators for Unlambda's core, a single combinator for Iota.

A tarpit is a proof of a surprising fact, turned into a toy. The fun is in the gap between "this can compute anything" and "it took me an hour to print a letter".

How it works

Every tarpit keeps the two things universality needs and throws away the rest.

Every tarpit keeps the two things universality needs and throws away the rest.

  1. Unbounded memory you can change, a little at a time (a tape, counters, a string, a term).
  2. A conditional loop or jump, to repeat until something is zero.

Everything else, such as numbers bigger than one, named variables, arithmetic, functions and strings, is built by hand out of those two.

Compare adding one number to another.

b = b + a
[->+<]       while cell 0 is not zero: take 1 from it, add 1 to cell 1

The Brainfuck loop is the whole addition. Multiplication is a loop inside a loop. Printing A (65) is a loop that adds 8 eight times, plus one. Every high-level idea becomes an idiom you build from scratch, which is why tarpit programmers trade idiom lists like recipes.

Tarpits fall into rough kinds.

KindMemoryExample
TapeCells and a pointerBrainfuck, Smallfuck, Boolfuck
One instructionNumbers in memorySubleq, BitBitJump
CountersA few huge numbersFRACTRAN; see counter machines
QueueA string read at the front, grown at the backBitwise Cyclic Tag; see tag systems
CombinatorsA tree of functionsUnlambda, Iota, Jot; see combinators

Seen in

Try this

  1. In Brainfuck, write [->++<]. What does it compute? What about [->+>+<<]?
  2. Pick a tarpit and write down the two things from "How it works". Where is its unbounded memory, and where is its conditional loop?
  3. Hard: design a tarpit with fewer than eight Brainfuck-style commands. Which ones can you merge? (Look up Boolfuck afterwards.)

Further

Where to see it

BrainfuckP′′SmallfuckBoolfuckSubleqBitBitJumpFRACTRANBitwise Cyclic TagIotaJotUnlambda12345678'129''14'1L_a1L_AOI2DFIM2DFuck2L3x4RLABCstrABFC (Another BrainFuck Clone)ABGAcc!!accufuckACLAddSubJumpAeolbonnAlice & BobAlphabet StewAlphabetti spaghettiThe Amnesiac From MinskAngry people outside my houseArrowFuckasdfAshAssemblerFuckAstridecBabylangBenedictumBF-MBFFBBFIbftreeBinaryLanguageBIObitchBitChangerBoring and Idiotic milk supperBoutBracketsLangBraimprovedBrain-FlakBrainBrainalphabrainappendBrainballBrainbashBrainchickenBraincrashBrainCubeBrainCursesBrainCursionBrainf with functionsBrainfaultBrainfishbrainflopBrainforkBrainfuck+10Brainfuck But With Bufferbrainfuck-ngBrainfuck SubstitutorBrainfuckerBrainfuckn'tBrainfuncBrainfunctBrainGuckBrainIfBrainJuiceBrainlispBrainloveBrainmultiBrainSpace 1.0BrainspinbraintuckBrainwhirlBraisnackBranchBRUHBSQBLBut Is It Art?Bitwise FuckeryByTBytFuckCakerCALCCapsCAR#CDILOICellCelumCharredCheatCholcCIOLCirclefuckCoeusCOPY WITH @CorkCountableCounterfishCounterScriptcpyCQfuckCratefuckCTFuckCutwDDRDeadbirdDeadfuckDipDJ Qarkegs - Above The SkyDoubleFuckdual tapeDubDubMachineEasyEasyFlakesEclipticaEcstaticEEEezyemotifuckEsoBASICExpensiveExtended Brainfuck Type IF-PULSEFactorFAGIFALSEferNANDoFerntapeFFM/FFBFinite-state mach... wait, WHAT!?FitForbinForeachForestFromageFuckhardFuckPackFuckscriptgeometryjunpGlassmanGödelangGoldfishGORBITSAGotoFuckGPRX 3000GrawlixGray SnailHanoi Love'#hell'Hyper-Dimensional BrainfuckHeadache (lang that compiles to brainfuck)HeadsecksHello Fuck!Hello today I am a unicornhoverflyHow dare you fuck the brainiagIdego.:iI1l!¡Immutable Brainfuckimplicit loop brainfuckInfinite GotoInvertedJolverineJormungandrJumperKarmaKavodKolmogorovKonamiCodel33tLa WeáLakshayatiLargeFishLazy KLeafuckLETTERLIMITEDLinear bounded brainfuckLNUSPLogicGatesLogicodeLoose Circular BrainfuckLorryLRIPMalbrainMastermind/ˈæmbiːɛf/MetatapeMindVomitMinesoMini-FlakMinimized BFMinISCuleMNNBFSLMogusMultiplicitynameless languageNASALNewbiefuckNiNoCommentNoidaNoodle SoupnormalcalcNumber2DNumberwangNyaScriptO_oObCodeObfuscatedFuckOCOOomnifuck1+Ook!oOo CODEOpenBSD toasterOr+3OTOHPain-FlakPainfuckPainLangPanaklongParrBFpbrainPDAsephonePicoPlusOrMinusPNIDPNPLPoeticPoeticFuckPointyPrimesprocessor.txtPurplePushDupAddSubPuzzlangPZABQadiqo???Quantum brainfuckQuestsQuineFuckQXRalRandom BrainfuckRCEMRe:directionRealmRegLikeRETURNRotatorRouedeuxRuckRuckfishS.B.M.F.BS₅Symbolic Brainfucksdac2SearchfuckSeclusionSemblySFINshortstack';#+'(SIASL)²Simon says brainfuckSkoundSKRSmilefuckSmurfSNUSPSpaces and tabsSpaghettiScriptSpeedScriptSPLSpoonStæckStackBitStackPointSTBFSubskinSubtractpocalypseSuperMarioLangSusT-rexesTACCTetrastackthisThreadFuckThree variable modification languageTic Tac ToeTinCantinyBFTISTitledTuring Machine But Way WorseToryTrackTransortogonal PolymorphismTriple ThreatTriTapetruecloneTtttTttttTurimgTurminTwocoman🐢◧◨(,)@!+-()啊!掉爆子脑操脑这不是编程语言!靈符¿అంతులేనిబైనరీలుUglyBFUppercase=LowercaseUrnUTooberV (FMota)VrejvaxWaduzitdoWasmThe Waterfall ModelWatnoxtWhizzWiseWoodchuckXcf4••YABALLYABFDYarenyupZed