Execute Brain****: Difference between revisions
Content added Content deleted
Line 4,734: | Line 4,734: | ||
[[/Perl|Implementation in Perl]]. |
[[/Perl|Implementation in Perl]]. |
||
===Actually compile the Brain****=== |
|||
<lang perl>#!/usr/bin/perl |
|||
my %code = split ' ', <<'END'; |
|||
> $ptr++ |
|||
< $ptr-- |
|||
+ $memory[$ptr]++ |
|||
- $memory[$ptr]-- |
|||
, $memory[$ptr]=ord(getc) |
|||
. print(chr($memory[$ptr])) |
|||
[ while($memory[$ptr]){ |
|||
] } |
|||
END |
|||
my ($ptr, @memory) = 0; |
|||
eval join ';', map @code{ /./g }, <>;</lang> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |