Live data from Hacker News

TrollScript, an esoteric dialect of Brainfuck.

github.com

41–49 of 49 posts

Re: TrollScript, an esoteric dialect of Brainfuck.

#43

Earlier quoted context omitted.

beautiful! 12 minutes : >,[[>,]] edit: of course it should be >,[>,]<[.<]

">,[>,] pStr++; *pStr = getc(stdin); //or wherever while *pStr { pStr++; *pStr = getc(stdin); } pStr--; while *pStr { putc (*pStr, stdout) pStr--; } It'll print the reverse of a string, but it will also print everything before it until it hits a null byte. I'd add to the beginning to null out the preceding byte and hope it wasn't important. As silly as brainfuck seems, I could see something like it being used in nano…

>It'll print the reverse of a string, but it will also print everything before it until it hits a null byte.

exactly! The brainfuck execution starts with the pointer at the first byte of zero-filled array:

http://www.muppetlabs.com/~breadbox/bf/

So the first ">" in my program moves the pointer to the next byte, and this skipped first byte would serve as a stopper when pointer moves back.

Re: TrollScript, an esoteric dialect of Brainfuck.

#46
post #44

I work for a company that primarily uses LOLCODE. I've been trying to convince my boss of the benefits of moving to Trollscript, so I wrote this Trollscript interpreter in LOLCODE: https://github.com/aduros/trollcat

If I could, I'd upvote you a million times.

Re: TrollScript, an esoteric dialect of Brainfuck.

#47
post #36

Something inspired me to write a Brainfuck interpreter after reading this so I just put together one in Scheme with a TrollScript compatibility layer. I haven't tested it extensively but it seems to work with everything that I've thrown at it. https://github.com/Wollw/BrainScript I wrote it using Guile 1.8.7 and I have no idea if I'm using Guile specific features or not. edit: Seems it's still a bit broken. The rever…

Here's one a friend and I did in Prolog last year: https://github.com/danieldk/brainfuck-pl Why? Because it can be done. And actually prolog's tracing mechanism makes debugging brainfuck code quite insightful.

I coded one in Pharo Smalltalk last year: http://www.squeaksource.com/BrainFuck.html It's so slow it's almost hilarious. It took it 8 hours to print an ASCII mandlebrot fractal frame, NO KIDDING.

Re: TrollScript, an esoteric dialect of Brainfuck.

#48

Earlier quoted context omitted.

">,[>,] pStr++; *pStr = getc(stdin); //or wherever while *pStr { pStr++; *pStr = getc(stdin); } pStr--; while *pStr { putc (*pStr, stdout) pStr--; } It'll print the reverse of a string, but it will also print everything before it until it hits a null byte. I'd add to the beginning to null out the preceding byte and hope it wasn't important. As silly as brainfuck seems, I could see something like it being used in nano…

>It'll print the reverse of a string, but it will also print everything before it until it hits a null byte. exactly! The brainfuck execution starts with the pointer at the first byte of zero-filled array: http://www.muppetlabs.com/~breadbox/bf/ So the first ">" in my program moves the pointer to the next byte, and this skipped first byte would serve as a stopper when pointer moves back.

Ah. I wasn't aware of that part of the spec. In that case, then, the code would work.

It's an interesting language, and one that I'm not convinced is so entirely without practical application as is commonly stated.

Re: TrollScript, an esoteric dialect of Brainfuck.

#49
post #2

A trollscript interpreter in trollscript: https://raw.github.com/gist/1204925/743626cf2313690d82243e99... Have it sung to you on OS X: $(curl https://raw.github.com/gist/1204925/743626cf2313690d82243e99... | say -v "Bad News")

Thanks to HN's URL shortener, with a little help from copy-paste, my mac is now singing the page source of github's 404 page
Post reply on HN