http://qs1969.pair.com?node_id=433161

Greetings fellow monks. As some of you know, three weeks ago I have started the Pugs project, to build an interpreter (and eventually compiler) for Perl 6. It can run some example programs and over 100 unit tests now.

Today I have started preparing Apocrypha 1, an overview of the Pugs project. As I plan to write it with a question-and-answer format, I have solicited freenode #perl6 for questions; a list is available on my use.perl journal.

I'd very much appreciate more questions, not neccessary of the "overview" type -- i.e. technical questions are fine. Feel free to ask them here in either this thread or over there in use.perl. I plan to send the article out (to Perl.com and TheMonadReader) in about three days, but further questions will still be answered. :)

Thanks,
/Autrijus/

Replies are listed 'Best First'.
Re: Questions wanted for Pugs/Perl6
by stvn (Monsignor) on Feb 21, 2005 at 21:07 UTC

    Let me first start by saying I think what you have done is really really cool. And I look forward to playing with Pugs in the very near future. My questions are simple, and I mean absolutely no offense by them what-so-ever. But I feel that these are questions that are probably on many peoples minds and both should be asked and should be addressed by you.

    1. Why did you do this in Haskell and not in Parrott? In other words, why not contribute to the ongoing perl6 project, rather than doing something totally different?
    2. Do you think that any of the experience you have gained in coding this can be transfered over to the main perl 6 project? And do you plan on doing so? (They are looking for someone after all)

    Again, I cannot stress enough that I mean no offense, and do not in anyway want to dismiss or play down your accomplishment. I would just like to know for my own curiostity, this is not meant to be a flame in any way at all.

    -stvn

      In answer to your question #2, I have to say that pugs has already contributed lots to Perl6. By implementing much of the things spec'd out in the various Apocalypses, Exegeses, and Synopses autrijus is "running ahead" of the Perl6 implementation effort and weeding out many edge cases and design faux pas. In this regard alone, pugs will make the Perl6 compiler implementation much, much easier. Also, it may be that if enough of Perl6 is implemented by pugs that it could be the bootstrap by which we get a full Perl6 compiler.

        I totally agree with your assessment. However, my question was more specifically was autrijus actually planning on sitting down with the current or future parrot/perl6 developers as well as Larry and Damian and really transfering all that accumulated knowledge.

        To be honest, from all the CPAN work I have seen of autrijus, and the commitment he seems to have to perl overall, if I had to guess, I would assume he absolutely would do this. So the question really isn't for me, but instead for those who are not already very familiar with Autrijus's work.

        -stvn

      Without trying to speak for autrijus, could it be that his expertise lies in Haskell and and not C/make etc.

      It also strikes me that given the impressive pace of his amazing work on Pugs, that maybe using a language with built in memory management; sensible & powerful built-in datatypes; coherent, cross-platform libraries; allows him to concentrate on the details of the task at hand rather than futzing with malloc()/free() et al.

      C maybe the only game in town for the level of cross-platform support required by Parrot (though I think that there is another contender for that also), but for the Perl6 compiler--and certainly the first cut of it--is there any reason not to use Haskell?

      Especially given that:

      GHC compiles Haskell code either by using an intermediate C compiler (GCC), or by generating native code on some platforms.

      Which in my ignorance I take to mean that GHC, and therefore Haskell, and therefore Pugs should run anywhere GCC runs.

      If true, that would be a huge stepping stone. Especially if it is possible to intercept the generated C sources and compile and distribute them separately? I guess that there would dependancies upon some GHC libraries involved that might complicate that though?

      Even though generated sources can be a pain for humans to deal with, it might provide a starting point for a non-GHC dependant "native" build of the Perl6 compiler?


      Examine what is said, not who speaks.
      Silence betokens consent.
      Love the truth but pardon error.
        It also strikes me that given the impressive pace of his amazing work on Pugs, that maybe using a language with built in memory management; sensible & powerful built-in datatypes; coherent, cross-platform libraries; allows him to concentrate on the details of the task at hand rather than futzing with malloc()/free() et al

        Functional languages are also known to be well adept for parsing, and since parsing perl is considered to be difficult at best and impossible at worst (except for perl of course) and I expect perl6 is better (but still difficult), that using Haskell was much easier than doing C/Parrot.

        C maybe the only game in town for the level of cross-platform support required by Parrot (though I think that there is another contender for that also),

        What is the "other contender" other than C? (Not that I don't believe you, just curious)

        Even though generated sources can be a pain for humans to deal with, it might provide a starting point for a non-GHC dependant "native" build of the Perl6 compiler?

        Personally I was wondering (after skiming some of the Haskell code) that maybe it could be bootstrapped as the parser and emit Parrot code, rather than try to fiddle with any generated C. Personally, I think a Haskell based perl6 compiler which emits Parrot code would be really really really cool.

        -stvn
      So...just to be clear, you mean no offense? ;)

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

      Do you think that any of the experience you have gained in coding this can be transfered over to the main perl 6 project? And do you plan on doing so? (They are looking for someone after all).

      That is not true: the Perl Foundation already have people in mind; what they are soliciting is money.

      Their proposal does mention "a second Parrot developer", but as Allison's comment on the page you linked to makes clear, that refers to a specific person who currently wishes to remain anonymous (because he doesn't yet want his current employer to learn of his plans to leave and work on Parrot) rather than a vacancy for a developer yet to be chosen.

      Smylers
        That is not true: the Perl Foundation already have people in mind; what they are soliciting is money.

        I only read/skimmed about 10 replies deep in that thread, so I didn't realize that :)

        -stvn
Re: Questions wanted for Pugs/Perl6
by sleepingsquirrel (Hermit) on Feb 22, 2005 at 03:26 UTC
    • How hard do you think it would be to turn Pugs into a Perl6 compiler?
    • Do you think that with some Template Haskell trickery, you could use Pugs as a compiler with a minimal amount of extra work?
    • Would you like to see a Pugs compiler?
    • If there were a full-fledged Pugs compiler, would you like to see it support backends other than Parrot (i.e. C or LLVM or .Net)?
    • Would you be opposed to having Pugs become the perl6 compiler/interpreter?
    • Now that you've got some Perl6 experience under your belt, are there any features of Perl6 that you'd like to see added/changed/removed?
    • Will Pugs on Haskell make it easier for me to make a statically typed dialect of Perl6?
    • How long do you think it will be before someone writes a Haskell interpreter in Perl6 (which runs under Pugs ;-)
    • Are there any plans to add optimizations to Pugs to make interpreted programs run fast (or is the main goal just a working, if not speedy, implementation)?
    • Has the work so far been easier, or harder than you initially thought.
    • What do you think of Parsec (compared to other parser generators)?
    • Do you wish that people who complain about your good work would have enough sense to just keep their mouths shut?


    -- All code is 100% tested and functional unless otherwise noted.
Re: Questions wanted for Pugs/Perl6
by rg0now (Chaplain) on Feb 21, 2005 at 23:15 UTC
    What is the relation of Featherweight Perl6 (FP6) and Pugs?

    What does the "side-effect-free subset of the Perl6 language" in the definition of FP6 mean?

    Is Pugs still targeting FP6, or have you moved over to implement the full-fledged Perl6 spec?

    rg0now

Re: Questions wanted for Pugs/Perl6
by sri (Vicar) on Feb 21, 2005 at 21:03 UTC
    What about NCI and XS, will there be a simple api for extensions?

      IIRC, there was already a replacement planned for XS in Perl6. There pretty much has to be, since Parrot changes how you access underlieing system libraries.

      "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

        Thats why i asked for NCI, it's not just planned, it already exists in Parrot. ;)
Re: Questions wanted for Pugs/Perl6
by kvale (Monsignor) on Feb 22, 2005 at 00:08 UTC
    I'd also like to thank you in advance for what is bound to be your hard work :)

    I know there has been some work on parrot piddles, i.e., compact multidimensional arrays like those used the PDL. Will Pugs include these as a part of the core, or as an extension?

    -Mark

Re: Questions wanted for Pugs/Perl6
by Limbic~Region (Chancellor) on Feb 22, 2005 at 13:47 UTC
    autrijus,
    What I hear from people in the net community when I mention Perl6 or Parrot is:

    I don't want to learn Parrot or compile ICU - I don't want to have to hack anything to get it to work - I just want to download something and start coding.

    I would turn this sentiment into the following question:

    Can I download an executable and just start coding Perl6?

    Cheers - L~R

      The thing that strikes me is the duplicate effort to implement Perl6. Asside from being an academic exercise, wouldn't it be more prudent to contribute to the existing effort or do it in a way that would be allow people to "download something and start coding" - namely in within Parrot, in c, or even in Perl 5? I applaud the effort, but is this really going to be useful in the long run? If not, why create yet-another-project to draw resources away from what has already been committed to?
        Greetings. I think chromatic has put it succintly: you seem to assume that if it weren't for Pugs, everyone working on Pugs would put the same amount of effort to the same effects into Perl 6. That not the case; Pugs has inspired dozens of people actively hacking unit tests and patches, mostly from people who will otherwise not be able to contribute to the Perl6 effort.

        Actually, the reverse of what you assumed is happening; Pugs is increasingly seen as a much more viable way to bootstrap the Perl6 process, and has been of much help for the language design.

        Also note that for many platforms, GHC is much easier to install than Parrot. :-) So I encourage you to install a GHC binary, download Pugs, and start hacking Perl6 now and send patches to perl6-compiler, as other people are doing now.

        Thanks,
        /Autrijus/

        Saying "draw resources away" assumes something I'm not comfortable assuming, namely that if it weren't for Pugs, everyone working on Pugs would put the same amount of effort to the same effects into Perl 6. Maybe that's true, but I doubt it.

        The thing that strikes me is the duplicate effort to implement Perl6.
        In order to duplicate something, doesn't there have to be an original? Where's the existing Perl6 interpreter? In fact, isn't Perl6 itself a duplicate effort? We already have a perfectly usuable and Turing complete Perl5. Anything that you could do with Perl6, you can already do with Perl5.
        Aside from being an academic exercise,
        What's wrong with an academic exercise? Maybe the author is doing this mainly to learn Perl6, or Haskell, or interpreter design. Maybe producing a Perl6 interpreter is merely a side-effect of the author's goal. In that light, Pugs is pure gravy.
        wouldn't it be more prudent to contribute to the existing effort or do it in a way that would be allow people to "download something and start coding" - namely in within Parrot, in c, or even in Perl 5?
        What if you don't agree that the current effort is proceeding in the best way possible? Should a person merely sit around and complain, or do something? What if the author isn't interested in Parrot, or C or even Perl 5. Why should anyone have to volunteer to work with tools they don't like?
        I applaud the effort, but is this really going to be useful in the long run?
        What if the author isn't interested in being useful in the long run? So what if it doesn't become useful in the long run? In the long run, we're all dead. Nothing ventured, nothing gained.
        If not, why create yet-another-project to draw resources away from what has already been committed to?
        What resources are being drawn away? It seems like a large chunk of resources have been added to the existing effort (Pugs is the proof). Are you paying the author money which you would have donated to the existing effort? Do you wish to force the author to do your bidding? Isn't Free Software all about the freedom to take a project in any direction you see fit?


        -- All code is 100% tested and functional unless otherwise noted.
        ...wouldn't it be more prudent to contribute to the existing effort...?

        Sure, and that's exactly what people are doing. While following what autrijus is working on, a lot of people have been able to pick up some knowledge of how Perl 6 will work. They've found difficult and ambiguous sections of documentation. They've asked questions. They've found things that didn't seem to work. They've written code and contributed test cases. All of these things help to improve Perl 6 and will help to shorten timeline to get to Perl 6.

Re: Questions wanted for Pugs/Perl6
by mkmcconn (Chaplain) on Mar 01, 2005 at 05:08 UTC
    autrijus, I am so grateful for what you've done. It goes very far toward taking all anxiety out of the newness of Perl6, by letting me put my hands on it. You want questions? Bro, Do you take paypal?!
    mkmcconn