(Cc'ing this post to p6i and p6l, as this is likely to concern folks
from all three mailing lists.)

As of Pugs revision 1024, this works:

    % pugscc --runparrot -e "'Hello, Parrot'.say"

And yes, it does what you think it does. Pugs takes that Perl 6 source
code, produce an AST, triggers the Compiler backend, generates some
PIR code, saves it into "a.pir", and runs it with the parrot
executable in path. The compilation and execution speed are both very
fast, and will get faster with embedded Parrot and/or Ponie support in
the future.

This also works:

    % pugscc --runhaskell -e "'Hello, Haskell'.say" 

Instead of PIR, it generates raw Haskell code using Template Haskell,
compiles it with GHC, and runs the resulting executable. Template
Haskell is really good for prototyping and verifying a compiler; the
code it produces is also quite fast, within 20% of Perl 5 speed.

The old, undecorated form of "pugscc" also works. It can also be
written thus:

    % pugscc --runpugs -e "'Hello, Pugs'.say" 

The "--pugs" backend is the only one that guarantees to run
identically to the pugs interpreter. Unsurprisingly, it merely bundles
the evaluator with the Pugs AST, and makes an executable out from that.

On a somewhat more interesting note, if you can build Pugs with the
"PUGS_EMBED" environment variable set to "perl5" (that works on
FreeBSD for me, but apparntely not on many other platforms), then you
can do this:

    % pugscc --runpugs -e "eval_perl5('print q[Hello, Perl5!]')" 

The eval_perl5($str) form is but a temporary kluge; it will likely
become eval($str, :language<perl5>), or whatever form preferred by the
perl6 design folks. Suggestions welcome!

Aside from perl5, I plan to add embedding support for Haskell and C
via hs-plugins, and Parrot support via the embedding API. Of course,
once Ponie gets up to speed, I can replace Perl5 and Parrot embeds
with it, which will save a lot of value casting works.

Tomorrow I'll hack some more to get mandel.p6 working correctly on the
two new compiler backends. Thanks to Dan Sugalski's help on #parrot, I
have figured out the PIR-level supports to get this done. Parrot is
really much, much saner than I had hoped; it eeriely supports lots of
things needed by a Perl 6 implementation. I wonder why that is the
case. :-) 

Thanks,
/Autrijus/

Attachment: pgp3LrqcpdaGL.pgp
Description: PGP signature

Reply via email to