4 ms·
Would someone mind giving a quick explanation of how this works? I have only used sed to replace text in files and directories. How do people write interpreters
by nate_martin 12y ago
Would someone mind giving a quick explanation of how this works? I have only used sed to replace text in files and directories. How do people write interpreters and game loops with this unix utility?
- mtdewcmu 12y agoWith difficulty. I started playing with the idea of making a programming language out of sed at one point, but then I decided that, even if I succeeded, it would be a waste of time. I didn't take into account Hacker News.
- jes5199 12y agothe sed language allows conditional jumps to labels. That makes it powerful enough to write programs in. If you had to just write programs by running a series of sed substitution expressions to a file over and over, and not use conditionals... it might still be possible to program in. Much harder to think about, though.
- rmorell 12y agosed is provably Turing complete: http://www.catonmat.net/blog/proof-that-sed-is-turing-complete/ http://www.catonmat.net/blog/proof-that-sed-is-turing-comple... which means that it's effectively able to simulate any other Turing-complete language (provided enough processing power and memory).
- bnegreve 12y ago> sed is provably Turing complete This submission is in itself, an elegant proof that sed is Turing complete.