Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

autrijus
  (email not shown publicly)
http://pugs.blogs.com/

Journal of autrijus (1505)

Saturday November 05, 2005
06:22 PM

Day 246: Eighth day at Liz's - Parrot interop.

[ #27469 ]
Today is the "Parrot is going to release tomorrow" day. The monthly release cycle is wonderful, as it ensures that the three Pugs/Parrot interops (embedding parrot, PGE rules, compiling to parrot) keeps working.

To that end, I fixed the Parrot codegen, removing deprecated opcodes and syntaxes. To my surprise and delight, I discovered that if I turn the parrotIsBrokenXXX flag to False, most tests in t/01-sanity/* still passes -- they used to break horribly, eaten alive by the rabid register alligator.

However, the new Parrot removed the ability to fake nested scopes with label-delimited inline closures, so some tests are now infinite-looping when compiled to Parrot. The correct (and easy) way to fix it would be using the new lexpad spec -- hopefully by Parrot 0.3.2 we will get both side implemented and work in harmony.

PGE got much more powerful with its ability to return anything, in addition to static Match objects. As a concrete demonstration, PGE now comes with a builtin p6rule rule that parses a Perl 6 rule string into a PGE::Rule object -- which will automagically appear in Pugs's $/ as a hash object. To wit:

pugs> ('1' ~~ /<p6rule>/)<p6rule>
Match.new(
   ok => bool::true,
   from => 0,
   to => 1,
   str => "1",
   sub_pos => (),
   sub_named =>
     { "expr" =>
         Match.new(
           ok => bool::true,
           from => 0,
           to => 1,
           str => "1",
           sub_pos => (),
           sub_named => {
               "type" => "term:",
               "value" => "1"
             }
         )
     }
)

Of course, it works for arbitrarily complex rules, not just a single character literal.

Note that we can't yet call the returned object's methods in Pugs, and there's no way to define rules using Perl 6 methods. This is because Pugs/Parrot doesn't really have a OO message protocol between them, and there are several complementary ways to solve this:

  • Implement calls to/from PMCs in embedded parrot, in the same way we tackled SVs in embedded Perl 5. This is trivial, but won't work with external Parrot (which is the only option in Win32 right now).
  • Compile Perl 6 OO code that adheres to the object model to PIR. This would require MM/PIL2 and lexpad, but we are going to do them anyway.
  • Port PGE to Perl 6. This is I hope what's going to happen in the long run, and will instantly carry the Rule engine to JavaScript and Perl5 runtimes, so it would be a net win.
  • Port PGE to Haskell, and write translators between it and Parsec. This will net us a truly rebindable grammar in the Haskell runtime, and allows us to translate Pugs.Parser piecemeal to Rules, so it's also somewhat attractive.

On a completely unrelated note, gaal is writing an article for TPR (The Perl Review) about Pugs -- feel free to chime in! (As usual, ask for a committer bit on freenode #perl6 if you hadn't got one.)

Last week's Shibuya.pm meeting features Catalyst, Ajax, Pugs and ICFP. Takesako-san did a nice presentation (PPT in Japanese) about Pugs, though some slides leaves me feeling excessively flattered. ;-)

But now, happy in the knowledge that Parrot 0.3.0 can fly with Pugs interop intact, I'll go back to MM/PIL2 hacking ere sleep. See you tomorrow!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.