Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found