Thursday, June 29, 2006

 

Perl5 -> Perl6 Translation Progress

Lots to report this week (fortunately). I've managed to get 1-2 translations live in svn every day this week. Here's the summary of (semi-)completed translations:

-When referencing a hash element: $hash{$something} -> %hash{$something}

-When referencing a hash element with a constant key: $hash{someword} -> %hash

-Similarly, accessing an array element: $array[$i] -> @array[$i]

-Conditional statements with the ? and : operators: a ? b : c -> a ?? b !! c

-Substitution regexs: $a =~ s/blah/blah blah/g -> $a ~~ s:P5:g/blah/blah blah/

I've been testing my code on more test documents, and so far so good. Some unknown node types, but for the most part the parser runs smoothly. TestInit.pm is almost completely translated, and I've been trying some things in /t/op. Cond.t was particularly useful for testing my translation of ? and :, it translates completely and correctly.

Current topics of work:

-Stage two design document (mostly regex changes). The regex changes should actually be very easy to implement. As soon as I finish the design I'm going to try implementing a few, for the most part they should be very fast.

-Heredocs. I hadn't realized that the AST treats heredocs a bit differently then most nodes (though it does make sense). I had though that heredocs would essentially be a normal openquote/closequote pair, but the different structure (the node may have both kids and literal information) makes it harder to handle. I started to code a fix today, but it may not be live for a bit.

-The rest of the stage one translations.

I'm fairly happy with my progress this week. I would've liked to have more translations finished, but at least I have plenty to show.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?