A proof that Unix utility sed is Turing complete

#100 · ✸ 9 · 💬 3 · 16 days ago · catonmat.net · sebmellen · 📷
Many people are surprised when they hear that sed is Turing complete. His proof is by construction - he wrote a Turing machine in sed. As any programming language that can implement a Turing machine is Turing complete we must conclude that sed is also Turing complete. Christophe offers his own introduction to Turing machines and a description of how his sed implementation works in his article Implementation of a Turing Machine as a sed Script. Here is an example program for his sed Turing machine that increments a binary number. Alan Turing can't believe sed is Turing complete. I'm a huge fan of Unix tools and I wrote a fun little book about sed called Sed One-Liners Explained.
A proof that Unix utility sed is Turing complete



Send Feedback | WebAssembly Version (beta)