syntax error at - line 1, near ";>"
- had compilation errors.
That's odd. What I get is:
sed s/eval/print/ t.pl | perl | perl -MO=Deparse
open $:, shift @ARGV;
$/ = undef;
$_ = <$:>;
tr/+-.<>[]//cd;
s/(.)/$1 /g;
s[((?:<\s) {2,})]['$b-=' . length($1) / 2 . ';';]egx;
s[((?:>\s) {2,})]['$b+=' . length($1) / 2 . ';';]egx;
s[((?:\+\s){2,})]['$a[$b]+=' . length($1) / 2 . ';';]eg;
s[((?:\-\s){2,})]['$a[$b]-=' . length($1) / 2 . ';';]eg;
s/>\s /\$b++;/gx;
s/<\s /\$b--;/gx;
s/([+-])\s/\$a[\$b]$1$1;\n/g;
s/\.\s/print chr(\$a[\$b]);/g;
s/,\s /\$a[\$b]=ord(substr(<>,0,1));/gx;
s/\[\s/while(\$a[\$b]){/g;
s/(?<=\s)\]\s/}/g;
eval $_;
This looks like a simple Brainfuck interpreter. Which makes me think one mistake is s/(?<=\s)\]\s/}/g; -- the (?<=\s) should be dropped. I first thought tr/+-.<>[]//cd; was bad too, but that I misread; +-. of course means "everything from + to .", which in ASCII means "+ , - .".
Update: The behaviour for , doesn't look right either. That should probably be done with something like
$/ = undef;
$_ = <$:>;
$/ = \1;
[...]
s/,\s /\$a[\$b]=ord(<>);/gx;
[...]
The current behaviour is not, strictly speaking, a bug. You can enter complete strings by entering the EOF marker (^D or ^Z) after each character. It is needlessly complicated though.