develooper Front page | perl.fwp | Postings from February 2007

Golf? BF?

February 13, 2007 11:10
Golf? BF?
Message ID:
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. 

On Feb 13, 2007, at 10:27 AM, Jim Thomason wrote:

> On 2/12/07, Chris McAvoy <> wrote:
>> On 2/12/07, Joshua McAdams <> 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 :)

> 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 (,
> 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, save the 
following as

And run it via:
cat | perl


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. 
312.804.0160 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About