Shrewd brainfuckers will have noticed that the aforegiven artistry has seemingly run afoul with recent perl incarnations. Versions 5.20+ exhibit severe indigestion upon encountering this following construct:

$ perl5.20.2 -e '/(?{ ++vec($x,0,1) })/'
Segmentation fault

But worry not, my brethren, for the remedy is at hand. Leveraging the remarkable prowess of a technology known as Inline::C, we are proud to have solutioned the next generation, industrial-grade tooling that is bound to meet, if not exceed, the demands of the hardcore brainfucker elite. Here it is, for your perusal, for your enjoyment:

#! /usr/bin/perl use Inline C => Config => CC => 'clang'; use Digest::SHA q(sha1_hex); open(CODE, '>', \my $code); my $ind = 0; sub o { print CODE " " x $ind, @_, "\n" } sub br { o 'while(*d) {'; ++$ind } sub be { --$ind; o '}' } sub pre { o << ''; ++$ind } #include <stdio.h> static void ich(unsigned char *d) { int c = getc(stdin); c < 0 || (*d += c); } static void och(unsigned char *d) { putc(*d, stdout); } static unsigned char data[30000]; void run() { unsigned char *d = data; undef $/; <> =~ m{ \A (?{pre}) ((?: [>] (?{o '++d;'}) | [+] (?{o '++*d;'}) | [.] (?{o 'och(d);'}) | [<] (?{o '--d;'}) | [-] (?{o '--*d;'}) | [,] (?{o 'ich(d);'}) | [[] (?{br}) (?1) []] (?{be}) | [^][<>.,+-] )*+) \z (?{be}) }x or die "Alzheimer"; Inline->bind(C => $code, NAME => '_'.sha1_hex($code)); run();


In reply to Re: Brainfunk. With Regex. by oiskuu
in thread Brainfunk. With Regex. by oiskuu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.