http://www.perlmonks.org?node_id=515185


in reply to The Perl Foundation Wants to Hear From You

I would like some information about the relationship between Parrot and Pugs. Are they friends, competitors, or both? What do they have in common, what is different? I got the idea, maybe mistakenly, that pugs is aiming for a full bootstrap implementation of perl6 eventually... whatever that means. Given that, and the publicity (and user community) pugs has generated, is TPF also funding Pugs at some level?

What's the deal?

  • Comment on Re: The Perl Foundation Wants to Hear From You

Replies are listed 'Best First'.
Re^2: TPF and Pugs
by Ovid (Cardinal) on Dec 08, 2005 at 18:04 UTC

    Again, that's another great question which should be posted to the blog. We'd really like that to be a centralized point for TPF communication so folks can have their "one stop shopping", if you will.

    As for Parrot and Pugs, there is no competition. Though related, they're actually in different problem spaces. Further, the Perl 6 design team has been quite grateful for the work Pugs has done to clarify many corner cases which previously had not been considered. However, I haven't paid very close attention to Pugs/Parrot interaction (I've had to be more focused on Parrot) so even though I'm aware there's been some communication there, I don't to what extent.

    And no, to the best of my knowledge, TPF is not funding any Pugs development though we've sponsored "Hackathons" for it. I believe we did this for Toronto and it's possible this will also happen for an Israeli Pugs hackathon, but details on the latter are still being worked out. However, those sponsorships are not handled by the grant committee (I turned them over to Jim Brandt, the conference committee head), so I don't know too much about what's involved there.

    Cheers,
    Ovid

    New address of my CGI Course.

      As for Parrot and Pugs, there is no competition. Though related, they're actually in different problem spaces.

      A while ago, I attempted to get a better grasp of what the respective problem spaces actually are, from A Plan for Pugs. I found the article to be a lot of fun, and inspiring, but kind of difficult to understand, probably because it deals with concepts that are a little beyond me. But at any rate, the money quote from Autrijus, or at any rate one money quote:

      Autrijus: Actually, I think Pugs and Parrot will meet in the middle. W +here Pugs AST meets Parrot AST and the compiler is written in Perl 6 +that can then be run on Parrot. chromatic: I thought Pugs would get rewritten in C for Parrot? Autrijus: No, in Perl 6. chromatic: Can GHC retarget a different AST then? Autrijus: It can, but that's not the easier plan. chromatic: It's easy for me. I don't plan to do it. Autrijus: The easier plan is simply for Pugs to have a Compile.hs that + emits Parrot AST. Which, I'm happy to discover yesterday, is painles +s to write. (Ingy and I did a KwidAST->HtmlAST compiler in an hour, t +ogether with parser and AST.)
      Another money quote apropos this theme:
      chromatic: Are you compiling it to native code now? I remember that be +ing a suggestion a few days ago. Autrijus: Pugs itself is compiled to native code; it is still evaluati +ng Perl 6 AST, though. chromatic: It's like Perl 5 in that sense then. Autrijus: Yes, it's exactly like Perl 5. Have you read PA01? chromatic: I have. Autrijus: Cool. So yeah, it's like Perl 5 now. The difference is B::* +is trivial to write in Pugs chromatic: Except maintainable. Autrijus: And yeah, there's the maintainable bit. Pugs is <4k lines of + code. I think porting Pugs to Perl 6 will take about the same number + of lines, too.
      Now, if only I understood better what these guys were talking about... someday.....

        In the first quote, we discussed how Pugs and Parrot could interact. There are lots of ways to run code on Parrot -- emit pure bytecode, emit source code that a language running atop Parrot can compile, manipulate Parrot data structures directly, or use the AST interface. An Abstract Syntax Tree is a more-or-less canonical representation of a program derived from parsing and, sometimes, optimizing its source code. If you use B::Concise you can get a sort of textual view of the not-quite-abstract syntax tree that Perl 5 uses.

        Pugs builds up an AST when it parses Perl 6 code. The plan there is to transform that into the same sort of AST that Parrot uses.

        An alternate approach would be to use GHC, the Haskell compiler that Pugs targets, to write a native code executable that handles Perl 6 code. Sometimes that works well for Haskell programs. Because of the way Pugs works, though, it's doubtful that this will give good speed. (The implementation uses a lot of monads, which are useful for getting some things done in Haskell, but they can be very difficult to optimize, having to give up a lot of the things that make pure functional lazy languages easy to optimize.)

        My question was if there was a plan or even an idea of telling GHC to emit Parrot AST code instead of C code... but that's not the plan.

        The second quote explains things more fully. Pugs itself isn't interpreted Haskell code, it's a native binary. However, that doesn't mean that the Perl 6 code it runs is native -- it interprets it in the same sense that perl interprets Perl 5 code.

        However, it's a lot more maintainable, at least if you know Haskell.

      A reply falls below the community's threshold of quality. You may see it by logging in.
      Why would someone give to the Perl Foundation instead of just giving directly to Mr. Autrijus Tang, or Mr. Wall, or whoever?

        See Grant Benefits.

        That depends upon why you're donating. If you're a US resident, you should know that grants to the Perl Foundation are tax-deductible. Second, I'm not aware if Autrijus, Larry or others accept direct donations. I suppose you could ask them, offer to sponsor a flight, buy 'em beer, whatever.

        Cheers,
        Ovid

        New address of my CGI Course.

        Tax-deductible contribution if made to the TPF. Section 501(c)(3) of the Internal Revenue Code. Individuals aren't able to receive tax-deductible contributions, no matter what they do with the money. IAAL <g>