Day 56: Leopold Toetsch on IRC!

autrijus on 2005-03-28T18:49:04

Two days ago I invited Leo to coordinate Pugs/Parrot issues on IRC; tonight he showed up on #perl6 and #parrot. Much discussions ensued -- this is definitely my wisest course of action during the past 56 days!

Alas, unlike #perl6, #parrot is not yet logged on the web, so here is an abridged transcript of the hour before the (brain)storm...

* acme summons leo
<@Psyche> now that's a spell gone wrong, eh?
<@acme> have faith, young Psyche
<@acme> drat, i really thought he was going to pop up
-!- leo_ has joined #parrot
<@Coke> holy smokes.
<@Coke> now, if autrijus were awake...
<@autrijus> hi leo!
-!- Coke changed the topic of #parrot to: OMG, is that *LEO*?

A two-hour brain tennis session followed, focusing on how to extend the calling convention and IMC types, so that the Parrot AST interface can work correctly. We reached many fruitful courses of action:

Pugs: Multi-pass compilation architecture.

  • The evaluator and three independent compiler backends will now work in concert.
  • Perl 6 source code will still be parsed to Pugs AST.
  • The current evaluator in Eval.hs becomes a compiler, generating a Parrot AST.
  • Parrot AST will then be compiled into Haskell, or pretty-printed into IMC code.
  • Existing code in the Eval monad need not to be rewritten, thanks to the monadic architecture and Template Haskell,

Pugs: Combinator library to emit Parrot AST.

  • Unlike existing IMC macros, it can be freely used without worrying about producing illegal IMC.
  • Pugs will ship with its own IMC parser, based closely on Parrot's one; a Lexer has already been transcrbed.
  • Pugs also needs to compile the Parrot AST into Haskell, probably using an IMC monad, with its own implementation of Perl* PMCs,
  • That means Pugs can still run Perl 6 by itself, but enhancement on it can then be shared with Parrot and other languages targetting IMC.

Parrot: IMCC enhancements.

  • IMC may need to have a .lexical pragma to simplify pad creation and management.
  • A Lazy PMC is needed to support the VThunk postponed-evaluation value type in Pugs.
  • The calling convention needs to be extended to allow the caller to propagate the calling context (want in Perl 6) to the callee, via tags like "PerlContext" = "Int" stored in a Hash PMC register.
  • A new @ARGS may be introduced to IMC to abstract away parameter processing code in the calling convention, and let us change the underlying convention mroe freely.

Here is some closing notes:

<@autrijus> leo: I need to sleep soon too. I'll be online ~20hr later
<@leo> and as IRC isn't that bad I'll try it again soon
<@leo> any final questions?
<@autrijus> leo: thank you a lot for doing this immensely sane system :)
<@autrijus> leo: also, if you have a server somewhere
<@autrijus> you can use GNU screen
<@autrijus> to stay on irc
<@leo> yep - thanks for the hint WRT sreen
<@leo> see you all
Other committers did not relax either, churning out enormous amounts of code in the past couple days:

  • rgs, our new committer and Perl 5.10 pumpking, implemented q// literals, fixed numerous problems in the build system, and hacked on luqui's perl6.vim.
  • ingy fought with MakeMaker again and emerged victorious: Pugs can now build modules with inline Haskell, link against the original .o files, and install them correctly. Now I need to get some time to make it work with Cabal to build the pugs package.
  • scw produced debian packaging files for Pugs, tweaked pugscc so it can generate IMC code anywhere, then hacked madly on getting :key(123), :key<abc>, :key[1,2,3] and :key working. He succeeded.
  • Stevan helped me with TODOing and unTODOing tests during 6.0.13 release engineering, then resumed his work on Pod::Stream::Parser, a POD parser that already works in Pugs.
  • Corion took the herculean task of implementing Perl5-compatible command line argument parsing, including proper support for many one-liner idioms.
  • mugwump, our resident OO ninja, single-handedly modeled out much of the Perl 6 OO system, with metaclasses, modules, traits and packages. He also made a funny Powered by PhD image, after hearing me saying that GHC is powered by dissertations. :)
  • darren continued working on SQL::Routine to make it into idiomatic Perl 6.
  • nothingmuch and theorbtwo continued to improve the excellent test result visualization tool, with the aim of refactoring it out into a general-purpose module that other projects can use.
  • vladtz added and refactored some tests. However, his commit log is empty, which makes summarizing his works a bit difficult...
  • gaal made the parser recognize $.x and $:y as variables, in anticipation of the upcoming OO core.
  • kcwu fixed a GHC warning, and made the t/pugsrun/ tests run pugs in a saner way.
  • luqui fixed a syntax error in Context.hs and normalized test files to begin with #!/usr/bin/pugs, instead of #!/usr/bin/perl6.

Finally, Jeff Horwitz released mod_parrot 0.2, which greatly helped my understanding of Parrot's embedding API. He also added a new high-level-language layer to support plug-in style development for languages targetting Parrot. Specifically, he plans to learn Haskell and implement a GHC layer for Pugs. This is likely to be very useful, and may pave a way for us to unify Haskell FFI with Parrot NCI in the future. Way to go, Jeff!


Actually...

jhorwitz on 2005-03-28T20:07:48

it's pugs' parrot compiler backend I'm excited about. Assuming a language is targeted to either parrot bytecode or IMC (and possibly AST -- haven't tried that) the HLL layer for language Foo can be written in Foo. No additional C, Haskell, or IMC is required. So we should be able to write the mod_pugs layer in Perl 6.

Now, I have yet to demonstrate that this works with a language other than IMC, but it looks like Pugs will soon have the necessary OO support so I can try it out.

I _do_ plan on learning Haskell though -- I really don't like the feeling of illiteracy when browsing the Pugs source. ;-)