>From a chicago PM list a 'golfed' perl BF interpreter:
----- Forwarded by Andy Bach/WIWB/07/USCOURTS on 02/13/2007 01:06 PM -----
Been there, done that [wrote the BF interpreter].
Here's a mildly golfed brainf*ck interpreter in 123b of perl:
%c=qw|> --$p; < ++$p; + ++$$p; - --$$p; [ ${ ] }while$$p; .
print+chr$$p; , $$p=shift;|;map{$r.=$c{$_}for split//}<>;eval$r
I'd golf it further, but I've been putting it off.
-Kent Cowgill
C2 Group, Inc.
[EMAIL PROTECTED]
http://www.c2group.net
312.804.0160
On Feb 13, 2007, at 10:27 AM, Jim Thomason wrote:
> On 2/12/07, Chris McAvoy <[EMAIL PROTECTED]> wrote:
>> On 2/12/07, Joshua McAdams <[EMAIL PROTECTED]> wrote:
>>> Okay, so this has nothing to do with Perl, but it really struck
>>> me as
>>> hilarious. It is a video about procrastination.... time to learn a
>>> new computer language instead of doing something useful in the ones
>>> that I already know :)
http://lifehacker.com/software/procrastination/ze-frank-on-procrastination-235859.php
>
> I was going to post this video...but I never got around to it...
>
> It's much much worse when you procrastinate by learning truly useless
> languages. I think I wasted the better part of a day once learning the
> intricacies of brainfuck (http://en.wikipedia.org/wiki/Brainfuck),
> including writing not just a brainf*ck interpreter, but a brainfuck ->
> C translator so I could compile my useless little programs for insane
> crazy raw power.
.
In case you'd want to see it in action, save it as bf.pl, save the
following as hello.bf:
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>+++++++
+[<++++>-]
<.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>+++++++
+[<++++>-
]<+.[-]++++++++++.
And run it via:
cat hello.bf | perl bf.pl
:)
Of interest is it doesn't fully handle quite everything, but it at
least runs the above brainf*ck program :)
-Kent Cowgill
C2 Group, Inc.
[EMAIL PROTECTED]
http://www.c2group.net
312.804.0160