News for hackers. Stuff that matters.
Re:Why you should learn brainfuck (or: learn you a brainfuck... by pedrocr on Tuesday February 22, 2011 @09:02AM (#2249882)
Just went out and wrote a simple interpreter in 65 lines of Ruby. It's pretty slow but seems to be correct.

One thing you didn't mention is that the cells are supposed to be bytes, and thus increment and decrement need to be modulo 256. That may not be part of the actual definition but the sample programs I found all relied on it.

I also found it pretty funny that "apt-cache search brainfuck" returns a total of 3 interpreters in the Debian archive.

Re:Why you should learn brainfuck (or: learn you a brainfuck... by skilldrick on Tuesday February 22, 2011 @09:12AM (#2249900)
Yeah, you're right about the cells usually being bytes. I followed the "spec" far enough for it to be a compliant implementation, but its fairly quick-and-dirty, and will probably break on more advanced programs.
Re:Why you should learn brainfuck (or: learn you a brainfuck... by radq on Tuesday February 22, 2011 @05:32AM (#2249411)
There's a really cool program that will convert programs written in an assembly-like language to brainfuck code.

http://inshame.blogspot.com/search/label/My%20Progs%3A%20Fuc...

I've been meaning to figure out how the program works, but the source code doesn't have a lot of comments so it isn't going so well.

Re:Why you should learn brainfuck (or: learn you a brainfuck... by yuvadam on Tuesday February 22, 2011 @09:06AM (#2249886)
Worth mentioning that the intent of brainfuck was to create a language with the smallest possible compiler.

Wikipedia claims [1] that most brainfuck compilers are < 200 bytes.

[1] - http://en.wikipedia.org/wiki/Brainfuck

Re:Why you should learn brainfuck (or: learn you a brainfuck... by skilldrick on Tuesday February 22, 2011 @09:15AM (#2249908)
Yes, I nearly put that in, but it didn't feel right. I've only given a very basic introduction to the language - the purpose of the blog was to teach the language rather than give its history.

Not quite - "Several brainfuck compilers have been made smaller than 200 bytes." - http://en.wikipedia.org/wiki/Brainfuck

Re:Why you should learn brainfuck (or: learn you a brainfuck... by skilldrick on Tuesday February 22, 2011 @12:40PM (#2250674)
I added this to the post in the end - on reflection I think you're right that it's worth mentioning.
Re:Why you should learn brainfuck (or: learn you a brainfuck... by schwabacher on Tuesday February 22, 2011 @03:54AM (#2249258)
This looks awesome, but god damn it! My todo list of things to play around with is growing faster than I can get to them.
Re:Why you should learn brainfuck (or: learn you a brainfuck... by skilldrick on Tuesday February 22, 2011 @04:40AM (#2249333)
Cheers :) Just give it half an hour...