You won't believe this one quick Perl 6 optimization hack!

Now that I've alienated half the crowd, here's the scoop. Perl6::Parser has a fairly extensive test suite, which I run on my laptop inside an Ubuntu 14.04 VM - it's the latest version I can find that supports seamless integration, though I'm considering completely dumping the GUI and going with just a few SSH connections.

But enough of that. Baseline Rakudo Perl 6 currently runs the Perl6::Parser test suite in 0.61s usr, 0.07s sys + 80s cusr time, 90 wallclock seconds, which is rather amazing considering how extensive and invasive the test suite is. After this one simple change, that …

Perl6::Tidy initial release

Perl6::Tidy has been released to GitHub, not on the ecosystem yet. The driver program is 3 lines, mostly passing options to the tidier. Which is 6 lines, doing the real grunt work.

It doesn't do much yet, but it's pure Perl 6.

Perl6::Parser available for Perl 6

It’s by no means complete, but it’s available for trial from your friendly neighborhood Panda installer. This tool uses Perl 6’s own internal parser in order to generate a parse tree for Perl 6 code, and has enough information to reconstruct the original Perl 6 source, complete with whitespace and comments.

perl6-Perl6-Parser is available in the ecosystem for trial. It’s very much rough around the edges, and can so far handle only a relatively narrow range of Perl 6 code, but that will quickly change, I’m sure. Once it’s further along you should be able to integrate this into things such as pretty-printers, editors, syntax highlighting and other tools. It takes compilable Perl 6 source and generates a tree of Perl 6 objects, which themselves have a .perl6 method to return the original Perl 6 source. Or feel free to override the .perl6 method and format your Perl 6 code how you want it.

Again, this is very crude, and I’ve released it just to get the idea out there. It handles some fairly complex code, such as:

sub median {
  my @a = sort @_;
  return (@a[@a.end / 2] + @a[@a / 2]) / 2;


sub propdivsum (\x) {
    my @l = x > 1, gather for 2 .. x.sqrt.floor -> \d {
        my \y = x div d;
        if y * d == x { take d; take y unless y == d }
    [+] gather @l.deepmap(*.take);

It’s of necessity slow going as I’m accounting for every bit of whitespace and backslash on the way, but it’s working so far. And yes, it does handle here-docs.

Join me online for 3 hours of Perl 6 training courtesy O'Reilly

Top Ten Things You Need To Know about Perl 6

As the title says, I'm working with O'Reilly to deliver a 3-hour training seminar on the basics of Perl 6 in mid-October. This is going to be more targeted to those learning Perl 6 ab initio, rather than seasoned Perl 5 programmers. I do intend to throw a f…

From Regular Expressions to Grammars (in Perl 6) Part IV

The fourth and final installment of the Perl 6 regular expression -> grammars tutorial has hit the blog: From Regular Expressions to Grammars, Part 4