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.

 

STM Progress Report (3)

Done since last report:
In progress:
Future-ish:

Wednesday, June 28, 2006

 

Report from DBI

The time since my last report went without too much progress I'm afraid to say, due to the end of my exam session I had to wrap up.

Nonetheless, I've written a logging prototype, which unfortunately can't be run on Pugs at the moment, but capabilities will arrive soon for that (.meta class, Role runtime "mixins").

In the meantime there is a temporary logging structure built in the code I've written so far, just to allow to get on with doing other things apart from logging.

Apart from this I've been looking at the Java JDBC, to widen my understanding about it and I've been thinking of how to get from what we have (JDBC), to what we need (DBI v1 API).

Monday, June 26, 2006

 

Filtration

I checked in a bunch of changes yesterday:
Today I'm working on finding a bug with perl -e 'use Gtk; use POE; $poe_kernel->run', and writing tests for POE::Resource::FileHandles.

Thursday, June 22, 2006

 

Progress Marches On

I feel I've got some good stuff done this week. I still have some nagging yaml issues, but beyond that I can reconstruct an AST into a complete program, and I have at least one translation ready to go into svn.

I finally got stuff committed to svn after far too long, and got some great revisions from Audrey. I had a couple of messy if/else/if/else... statements that Audrey turned into cases. I knew cases would work better there, but I hadn't been able to get one to work. This project has really taught me the weak points in my practical knowledge of Haskell. At my school they use Lisp to teach functional programming, so my knowledge of Haskell was more theoretical then practical, as show by my problems getting a case to work correctly. Luckily I'm picking things up quickly.

Today I made a major breakthrough on how I represent the AST. Since I (will) have a number of functions that only work on one type of node for translations, I decided to abstract out nodes to a larger degree. A P5AST is now made up of AbstractNodes and LiteralNodes, with each node having a type to further narrow it down, such as (AbstractNode Op_leave []) or (LiteralNode PNothing "1" "#junk"). This allows me to abstract out functions quite a bit, it cut down the print tree function to 5 or so lines of code.

Again, my mistakes are teaching me a lot. With the stuff Audrey corrected in my code I can make further change with a better understanding. I just hope I don't feel too stupid after these revisions.

All of my work to date is available at http://svn.openfoundry.org/pugs/misc/pX/Common/P5_to_P6_Translation/ . translations.hs shows Audrey's optimizations, translate-sage.hs shows my new approach to the AST (these two will be combined to create an effective version with a better tree). AST_description sums up some details on the AST that I think are useful, mostly the stuff that I've worked out on my own. Details on the rest of the directory are summed up in the README.

Overall I feel this has been a slow week, but with some really good stuff happening in the last few days. Good stuff, as we head into the midterm review. I'd say, while my project has moved slower then I'd like, it's only going to get faster from here, and I'm on track to get at least the minimum translations done, probably more.

Wednesday, June 21, 2006

 

STM Progress Report (2)

Done since last report:In progress/near future:
To investigate:

Saturday, June 17, 2006

 

Perl5 -> Perl6 Translation Update

Well, I'm having problems with reading in the AST from a file. I've got all the basic stuff covered, but one odd case (some of the block yaml stuff) is giving me problems. I've got some basic translations in, but I really need to finish the AST input before I do too many more.

The case that's giving me problems is a Yaml literal block with chomp modifier: When a node has 'uni: |+' I'm having a hard time, mostly since the end of the block is only identified by the beginning of another node. I haven't been able to find a good way to get Parsec to look ahead to check if a node starts on the next line without consuming it.

Everything else is going well. I have all the other cases covered (that I know of), so I've done some of the easier translations on the node types that are already complete.

I'm a little concerned that things are moving slower then I'd like, but I think my progress is about as fast as most of the other projects, so hopefully I won't be behind.

 

Starting to write tests

I finished my exams, so I've sat down and started on the first set of tests to write: for modules that currently have absolutely no coverage.

Part of this is figuring out where the tests go in the POE source. The test system has quite a complicated structure because parts get automatically copied to help test different combinations of runloops and queues.

The other challenge is that the uncovered modules are the some of the trickiest to test well. One is POE::Wheel::ReadLine which provides a prompt with line editing like a unix shell (or the CPAN shell even) but its main function is interacting with the user and simulating a user isn't going to be terribly easy. I suspect that I'll end up not covering it fully, but instead just testing that it compiles and loads, and has the right functions available to the programmer.

Update: I've just noticed that the proposals are now visible on google's website.

 

Weekly report -- Pugs bootstrap -- 6/11 ~ 6/17

I have to say embarrassingly that there's no progress this week -- not even a single new character in source files. And, after this short report, I'll go back to my novel (homework) and compiler project. Sigh.

Wednesday, June 14, 2006

 

What's new this week on the DBI front

This week, progress wasn't from the immediately visible - code - kind, but rather from brainstorming over various basic parts of DBI and exploring Perl 6: figuring out to handle tricky issues such as logging elegantly, without including it in a dispatcher mechanism (the DBIv1 way) or how a handle looks like (whether an application handle HAS-A driver handle or IS-A).

The current design is to encapsulate logging/tracing/profiling behind a role, so it basically intercepts and redispatches (basically overriding) method calls when it is composed at runtime into a handle.

About the handle issue, my mentor, Tim Bunce feels that breaking with the way DBIv1 HAS-A handle would be more fitting for Perl 6; rather than to use JDBC for an inner handle and then wrap it in a fixed class, which would make subclassing easy, he thinks that this isn't the best or most flexible way to tackle the issue. This would make subclassing not so easy, but then it can be encapsulated to make it easy again. :)

In the short term I'll be coming up with a PoC for the logging/tracing role and then continueing to work my way through the design of DBI, detailing and hashing out the specific parts.

Tuesday, June 13, 2006

 

STM Progress Report

Done in the past few days:
Near future issues:
Further future issues:

Sunday, June 11, 2006

 

Weekly report -- Pugs bootstrap -- 6/4 ~ 6/10

Facing my homework, course projects and final exams, it's not a very progressive week. I hacked into the parser generator module to accept more syntax which might be used in the final grammar (blogged here).

And the main part of my project has began. Only in my working copy since it has only skeleton now. Only the starter subroutine of the module has some code in it. The architecture is copied from other backends of Pugs::Compiler::Rule, so that the overhead of maintaining different emitter can be minimized.

Thursday, June 08, 2006

 

Another Week, Another Update

Finally getting some code written this week. Working in Haskell (for use with Pugs), I've got the basic structuring I need to hold the AST of a Perl 5 program, I'm working today on getting an AST from a file (produced by Larry Wall's parser) into my Haskell structure. With any luck, by the end of the week I think I'll have the basic translations outlined in my design document implemented. I'm also working on laying out a more in depth design document for stage two (more complex translations) and doing research for the higher level translations, such as translating the various P5 object "standards" to the P6 standard.

As for myself, I've been learning like crazy. It's great being plunged into this stuff, my school work isn't challenging like this, I've really been forced to learn a lot about languages in general and Perl in particular. I've made more mistakes then I'd like, but I've learned a lot from those mistakes, so I'd say things are coming along alright so far.

Tuesday, June 06, 2006

 

Progress report #1 for Perl 6 DBI

I've put together a logic overview of the DBI, so that the new internals can be planned. The document itself will be extended of course, but it is enough at the moment to take the first steps.

I've successfully tested perl5::JDBC code working with Pugs and currently I'm in the process of determining basic functionality required to simply do a 'connect' and a 'do', and to write some code to get that working.

I've also been developing a mental picture of how it all fits together, as in keeping the old API and not sacrificing the internals for the sake of it too much and also how to best bridge the gap between what JDBC offers and what we need.

Saturday, June 03, 2006

 

Weekly report -- Pugs bootstrap -- 5/28 ~ 6/3

Also not too much to write. I made two posts on my blog:
    A new month, a new stage
    Well formatted grammar

I'm mainly planning how to do the next step, which is the core of my project. And, as the posts said, did some feedback to perl6 language mailing list. Some works are done based on the reply of the mailing list post, too.

Friday, June 02, 2006

 

Introduction Final

So a belated introduction:

I, Charles Reiss, am an American student working on adding Software Transactional Memory support to Parrot. Software Transactional Memory brings those transactions we all know and love in databases into ‘ordinary’ multithreaded programming and are, fortunately, a well-studied area with one mainstream implementation in the Haskell compiler GHC. Implementations of STM provide better performance than traditional locking under most circumstances by optimistically assuming that there will be no contention: different transactions are allowed to execute concurrently under the assumption that they will not conflict; if they do, only one is allowed to commit and the other is retried.

I've created a separate branch for this project in Parrot's repository (parrot/branches/stm) and placed some (preliminary) design/documentation in the repository (.../docs/stm). In addition to the usual orientation stuff everyone will probably mention, I've added some atomic operations implementation and made it easier extend Ref there, and I next plan on creating the user-visible side of the implementation (ops, PMCs, etc.) and making it call a stub backend.

 

_start

First a few words about myself: I'm a British student reading maths at Cambridge. I've known perl and UNIX for quite a while now and I've used various parts of the excellent perl community such as perlmonks and irc for help in the past, and it's really great now to have the opportunity to work on a very interesting module.

POE is, at its heart, a big loop. Admittedly it's got a lot of features such as pluggable loops, wheels, drivers, filters, alarms, signals, aliases, states, components and sessions (which isn't really the friendliest list of jargon a module could have); but in the end it just waits for something to happen, and then finds your code to handle that. The beauty is that it works whether you're using select, Tk or Event (there's others too) to multiplex your filehandles, and it saves you writing quite a bit of code that's the same in every app.

Right now I'm studying for exams, so I haven't dived straight into writing code (not that you should without a plan), so I'm been learning POE's existing test suite, and the handy script by Rocco has for running the test suite under coverage. I couldn't resist adding a few features to it, and throwing together a commits bot for irc though.

Coverage (by line) has turned out to be higher than I expected, so as well as getting overall coverage up, I'll be paying more attention to the ‘depth’ of tests in branch and code coverage, and in different combinations such as wheels with loops. A complete list of my deliverables and goals should be in the proposal that google will publish at some point.

Thursday, June 01, 2006

 

One week down...

Not too much to report this week. Spent a lot of time getting everything set up, in life as well as on my computer, and getting a design document together.

The only really deliverable I have for this first week is my design document for stage one. Having talked to my mentor, our current plan is to have me work in stages, since the translations range from the mechanical to the complex (such as OO conventions). This week I put together a design document for the basic translations I'll be making for stage one, the simplest stuff. I've posted the document, in case anyone is interested. This is by no means a complete list of the translations I'll be making, it's just the first round, something to be implemented while I get comfortable with the current state of the code.

Next week I start implementing the basic code and putting together a design for the more complex stages.

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