Sunday, July 30, 2006


STM Progress Report (7)

Since last report:


Weekly report -- Pugs bootstrap -- 7/24 ~ 7/29

(copied from my blog)

Main goal of this week was to complete the Parsec emitter. However, due to some natural limitation, it's not possible to really "complete" it, I just try my best to complete as many components as I can and hope those be enough for writing complete Perl 6 grammar. The accepting grammar constructions implemented from last post are:
And I mailed pmichaud++ about the different semantics of "non-backtrack" in Perl 6 rules and Parsec parsing strategy. The :ratchet option, which is turned on by rule and token, is to make backtrack over atom fail. But different branches are still tried even if first several atoms in one branch are matched. In Parsec, the whole parsing fails if it goes into some branch, consumes some tokens and is unable to go on further. However, this can be changed by wrapping the branch with "try," which, as the name tells, tries to match the branch but will try other ones if failed. Such action is like adding a "::" after each atom instead of adding ":", which is done by rule and token in Perl 6 grammar.

One way to solve it is to add "try" everywhere. But that means giving up the high-efficiency parsing provided by Parsec. When the grammar is not LL, it's unavoidable. Parsec performs best on LL grammar (from official page), so in this stage, I'll feed only LL grammar to it and no additional "try" is added.

Thursday, July 27, 2006


Translation Update

This week has been mostly about basic issues, with only a few translations completed. On the other hand, I have enough translations completed that it's not surprising, since most of the stuff I have left to do is the stuff that's the toughest for me.

Completed stuff this week:
-Heredocs now parse correctly and translate.

-Yaml blocks with the chomp modifier (|+) parse correctly, even inside heredocs.

-All node types now recognized.

The result of all this is that, as far as I know, my translator can now at least partially translate any P5 AST with no unknown nodes. I'm working on a test script to test this theory, but in my manual testing it seems to be true.

Now I just need to get the rest of these translations done...

Sunday, July 23, 2006


STM Progress Report (6)

Done since last report:
Disturbing discoveries:


Progress report -- Pugs bootstrap -- ~ 7/23

(copied from my blog)

I finally escaped from the final exams and projects, and the unexpected busy early July. The first checkin of the Pugs::Emitter::Rule::Parsec module is on July 20th. It accepted and emitted correct Haskell code on the yada example given in the README of MiniPerl6 module. (By the way, the Pugs::Grammar::MiniPerl6 and Pugs::Compiler::Rule modules have been moved from pX/ to perl5/)

After three days' hacking, it now accepts a lot of rule constructions. Also, a test file was added. In Parser.Literal there are 10 parser routines, two of them take arguments (namedLiteral and possiblyTypeLiteral) which I currently don't know how to present in Perl 6 rule, one uses previous parsing state to decide next action (ruleWordboundary), all other seven can be easily generated. In fact, all seven of them are already in the test file, the result is tested by replacing existing code by the generated one proven that it gears Pugs' parser, too.

P.S. As the matter of fact, two of the ten parsers (ruleDot and ruleLongDot) use non-LL grammar so that a little modification by hand on generated code is needed.

Thursday, July 20, 2006


Translation News

This week was a little slow due to a flu I managed to catch. Despite a week of decongestants and coughing, I managed to make considerable progress on translating regular expressions. I wrote a (fairly simple) parsec parser that takes a Perl 5 regex and spits out as close to a Perl 6 regex as it can. Some of the translations will have to be in external functions, since the parser only sees the text string of the regex, not the quotes or any of the other externals.

The sheer number of completed items to show for this week makes it look like a VERY productive week, even if a lot of the translations are almost trivial to implement (translating one metacharacter is a lot like translating another metacharacter, for the most part). Still, I'll take my victories where I can, and marking off a large number of items from the Perl 5 -> Perl 6 translation guide this week felt great.

For the remainder of the week I'm working on finishing up regexs and some of the tougher Stage one conversions. I think, with some careful re-reading of Synopsis 5 I can take care of my remaining regex issues. Beyond that, I need to get a clear reading of what issues I've handled, what I've identified and still not completed, and what I just plain haven't touched on yet. I'm hoping to start next week with getting a clear view of what I've done and what I still have to due, and then dive headlong into what I still have to tackle.

Friday, July 14, 2006


STM Progress Report (5)

Done since last report:
In progress:
Near Futurish:
Further Futurish:

Thursday, July 13, 2006


Translation Update

Some big changes in the code this week. I've ended up with more code just for parsing and other tasks then I expected, so I've packaged everything up into some nice little modules. I also decided my code had reached the point where it was a good idea to move from a function called in GHCi to a compilable program. I've also added command line switches for some of the debugging functions, such as a verbose mode and unknown node identification.

I've also updated all my documentation with a full break down of what the modules do and how to use them. The only thing lacking is a makefile (I've been using ghc -- make for now).

Also this week I've added a couple of new translations (including foreach loops) and some HereDoc support (which is broken at this point, but it doesn't perturb anything else).

The code is now more usable then ever, it can parse everything but heredocs, and it can translate a good bit too, plus it's more user-oriented (as opposed to the function version, which was more for debugging then anything).

Saturday, July 08, 2006


Perl 6 DBI update

There is quite a lot of progress since my last report, I'm happy to say.

I've turned my attention towards Error Handling & Management, which happened to be tricky for multiple reasons. JDBC is Java, so it uses Throwable objects to throw exceptions. Inline::Java, which is based on, uses the caught() method, eval and $@ to pass these exceptions to the Perl 5 side. Then I needed to trap these exceptions in Perl6 land.

Thanks to audrey++ for implementing my requests, so that now Pugs can handle unclaimed dies from perl5 land, caught by try { }, pass $@ as $!, and deal with the contents of $! if it happens to be a reference to the Throwable object dealing with the given exception (test here).

Another reason Error Handling is tricky, is because JDBC doesn't know the concept of a 'current error', but DBI has ($h->err), so there is a dispatch layer needed to handle the Error handling methods. I've written the exception handling part to trap JDBC errors, and a basic set_err method, currently works with RaiseError on.

I've also updated the Statement class's execute method, so that it can deal with SELECT and non-SELECT statements now aswell. On non-SELECT statements it returns the updated row count, if available. On SELECT statements it returns a true value.

To be able to retrieve the results of a SELECT statement, I've implemented fetchrow_arrayref in the Statement class.

Next, I'll work on getting more done from error handling & management, and when it reached a more reasonable state I'll start working on implementing prepared statements, with placeholders.

Friday, July 07, 2006


POE tests status update

Some things I've completed include:
I haven't quite got all of these changes and a few smaller ones checked into the main repository yet, and at the moment I'm working on refactoring the POE::Wheel::Run tests with support for the new 'pty-pipe' feature.

Thursday, July 06, 2006


Translation Progress

Not much to report this week. With the Independence Day holiday here in the U.S. I wasn't able to do as much as I'd like. Got some new translations done, the list of conversions shows what's completed, and it's good to see a fair number of done items. I'm already looking ahead to the next round of translations, since completion of stage one seems to be getting close.

I found some errors with my parser this week while testing more files, mostly files from t/op/ of the Perl distro, version 5.9.3. I've compiled a few bug fixes that I need to do, I hope to have everything I've found so far fixed by next week so I can continue to broaden the number of files my translator can at least partially translate.

For next week: bug fixes in the parser, more stage one translations, put out list of stage two conversions for comment/review/advice.

Wednesday, July 05, 2006


STM Progress Report (4)

Done since last report:
Near futureish:

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