This is my first posting, and a couple of things caught my eye in one night. First of which is uncovering the language BrainF*** (yup, very Anglo-Saxon name, that). Thinking, I realized just how easy it would be to make an interpreter for that language. Dreadfully simple actually, so I can't really take pride it. But, I would like feed back. This works fine on all known good BF programs I can find, however on the '99 Bottle of Beer' program, it gets to 91 bottles, and hangs, spiking the CPU. Any ideas how to fix I would like to here. Getting the obfu to look good is damn near impossible. Are there any programs to assist with that to get those 'Perl Artist' look to them? (See Swamp Thing below. *drool*)
Here's the code:
<-----Cut Here------>
#!/usr/bin/perl
#BrainF*** interpreter. Give filename as arguement, or
#reads from STDIN
s''while(<d>){s/ [^\<\>\[\]\.\,\+\
-]//g ;$a.=$_ ;}$_=$a;$,=0;@,=
();d y/\<\ >\[\]\
+\-\.\, /zbxu_qs k/;
s/z/\$,-- \;/g; s/b/\$,++\;/g;s/x
/while(\$,[\$, ]!=0){/g;s/u/}/
g;s/_ /\$,[\$, ]++;
/g; s/q/\$ ,[\$
,]-- ;/g; s/s/
pridntdf"%c",\$, [\$,
];/g;s/k/gdetc \$,[
\$,];/g;edvad l;';s
[\s|d]$$g; eval
<-----Cut Here----->Link for BrainF*** scripts:
Here
Toodles
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.