Jeff Atwood is the best tech blogger in the world, in my opinion. And his most recent post contains my nominee for the quote of the year:
Open source software only comes in one edition: awesome.
I haven't really been working on features for my Perl 6 PDF grammar very much, but I have been using it as a tool to follow improvements in the Rakudo implementation of Perl 6.
This week, I went through all of the PDF code and looked for comments I wrote for myself about workarounds for incomplete parts of Rakudo. The exciting news is that I was able to remove about half of my workarounds this week. Considering that most of the rest of the annoyances are features that are on the near-term roadmap (mainly, PGE refactoring), I consider this to be superb progress.
Bravo, Perl 6 developers!
I made a contribution of my own, too, which has made me absurdly happy out of proportion to the size of the patch. I implemented 'make' from S05. This builtin function is shorthand for the following:
# Equivalent code:
$/.result_object($value);
make $value;
This, along with other simplifications allowed me to shave about half of the lines of PDF::Grammar::Actions while improving readability. Yay!
Today I moved Perk (a Java compiler targeting Parrot) to github. I do not intend to maintain the SVN repository at googlecode. Sorry for the churn, but better now than later...
I am working on converting the actions.pm to be real Perl 6 instead of NQP. I submitted a prerequisite patch to Rakudo to support that (implement the 'make' builtin). But I'm getting mysterious runtime failures with basic PIR.
If you want to try Perl 6, just edit one line of the Perk Makefile to change "ACTION_COMPILER=nqp.pbc" to "ACTION_COMPILER=perl6.pbc".
Once I get that to work, I'll probably port perk.pir to perk.pl. Then we'll see about implementing more of the actions.
I'm headed to Frozen Perl tomorrow. My talk is titled Using Rakudo Grammars, but it ended up being more about Perl 6 than specifically the Parrot/Rakudo implementation.
I'm looking forward to the hackathon Sunday. I'm thinking that I'd like to work on enabling any language's PCT actions.pm to be implemented in Rakudo instead of NQP. Patrick Michaud mentioned a few blockers in IRC, so I'm hoping to work on those.
I moved my Java parsing experiment from my own SVN to the Squawk project. Squawk is intended to Parrot-based languages that are too small or immature to live on their own.
I chose the name "Perk" for my implementation to avoid any risk of Java trademarks. It's short, it reminds you of caffeine, and it's only one letter away from Perl.
If this project doesn't wither on the vine (a very real possibility, I admit) then I hope it will be source code compatible with basic Java. I have no intention of any interoperability with Java bytecode or the Java VM.
The source code is easily browsable. If anyone is interested in participating, I welcome the company. There's no way I'm going to make more than a dent in this project by myself.
A couple days ago I wrote about Java syntax for hexadecimal representation of floating point numbers like this:
0x1.fffffeP+127f
Here are the Perl 6 grammar snippets I put together to parse this. Easy!
token HexLiteral {
'0' ['x'|'X'] [
| '.' <HexDigit>+ <HexExponent>? <FloatTypeSuffix>?
| <HexDigit>+ [
| '.' <HexDigit>* <HexExponent>? <FloatTypeSuffix>?
| <IntegerTypeSuffix>?
]
]
}
token HexDigit { [\d|<[a..f]>|<[A..F]>] }
token HexExponent { ['p'|'P'] ['+'|'-']? \d+ }
token FloatTypeSuffix { 'f'|'F'|'d'|'D' }
Last week I reported that I had a working parser for Java source code implemented as a Perl 6 grammar. Well, a dozen or so bugs later, it actually works now. Out of 7,000+
public static final double MAX_VALUE = 0x1.fffffffffffffP+1023;
public static final double MIN_NORMAL = 0x1.0p-1022;
public static final double MIN_VALUE = 0x0.0000000000001P-1022;
...
public static final float MAX_VALUE = 0x1.fffffeP+127f;
public static final float MIN_NORMAL = 0x1.0p-126f;
public static final float MIN_VALUE = 0x0.000002P-126f;
Hex notation for rational numbers -- what an interesting idea. I've never encountered that before. It appears that this notation first appeared in the 3rd edition of the Java language specification.
This seems to me like a notation worth adding to Perl 6, given its inherent precision advantages over decimal notation.
My favorite part of Perl 6 is the new grammar syntax. Over the last couple of days, I translated a Java source code grammar from antlr to PGE. After about 4-5 hours of work, I now have a Perl 6 grammar that can parse all of the
Admittedly most of the credit goes to the authors of the antlr grammar I adapted, but this also says good things about the Perl 6 regex implementation in Parrot.
The things that bit me hardest were:
For the last 20+ years, my favorite sci-fi/fantasy author has been Lawrence Watt-Evans. His books are not always profound, but they just fit my brain. He's currently writing a sequel to his 1989 sci-fi mystery Nightside City.
The catch is that he's writing it one chapter at a time and holding future chapters hostage until he gets enough donations. His goal of $300 per chapter is both reasonable and steep, depending on your point of view. He justifies it thoroughly in his FAQ.
If you've ever read one of his books, or just enjoy sci-fi, or have ever used one of my modules and feel you owe me
I've been curious to peek at Padre, Gabor Szabo's new editor, but it's Test::NeedsDisplay prereq always failed for me with an obscure recommendation to install xvfb-run. It turns out all you really need is to run "wxPerl Makefile.PL" instead of "perl Makefile.PL". I added a note to that effect in the Makefile.PL (thanks to AdamK's open repository).
So, any Mac user who wants to try Padre can use this trick (I didn't actually test this exact technique since I got it installed via a much more convoluted trial-and-error process).
cpan install Wx
wxPerl -MCPAN -e install Padre
Now I'm off to report some bugs...