#!/usr/bin/perl open P,shift;%p=('>',sub{$p++},'<',sub{$p--},'+',sub{$p[$p]++},'-', sub{$p[$p]--},'.',sub{print chr$p[$p]},',',sub{$p[$p]=ord getc},'[' ,sub{&c} ,);sub p{ exists$p{$_[0]}&&&{$p{$_[0]}}}p getc P until eof P; sub c{push@c,getc P until$c[@c-1]eq']';do{p$_ for@c}while$p[$p]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: BF interpreter
by ikegami (Patriarch) on Aug 23, 2006 at 21:56 UTC | |
|
Re: BF interpreter
by locked_user mtve (Deacon) on Aug 25, 2006 at 10:45 UTC | |
|
Re: BF interpreter
by truedfx (Monk) on Aug 28, 2006 at 07:20 UTC | |
by gustavderdrache (Acolyte) on Aug 30, 2006 at 20:42 UTC |