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
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
% 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
I'm restricting the distribution back down so that I'm not creating a
> As of Pugs revision 1024, this works:
> % pugscc --runparrot -e "'Hello, Parrot'.say"
How appropriate a revision number....
I must say that pugs continues to out-strip every expectation I've had.
> 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. :-)
Oh, I think it's because Parrot was designed to be able to run Haskell
Aaron Sherman <a...@ajs.com>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback
Thanks. One of my remaining large TODOs before Pugs 6.2.0 is to
recode the evaluators in Template Haskell as Compile/Haskell.hs,
so all code is always compiled. The Template Haskell macros should
then be rewritten into something resembling your ast/ast.h, which
is an AST for generating syntactically and semantically correct PIRs,
without the need of hard coding any strings using PrettyPrinter.
I'd very much like to talk with you about Compile/Parrot/AST.hs
the next week -- IRC or SEE/MoonEdit/Skype if possible. I understand
you're on metered ISDN, and I'd gladly pay for your bandwidth fee. :)
But if mails are preferred for you, I can do that as well.
> 1) s__z = s__t # mandel.imc:149
> This aliases the two PMCs, it's specifically not an assignement.
> set Px, Py # PREG(1) = PREG(2);
> both PMC registers point to the same thing then.
Aha! Thanks for the hint. I see that the form above should perhaps
be used for :=, not =. Fixed as r1200.
> 2) Parrot understands two forms of source line comments:
> a) C-like: #line "file" line
I'll use this for now; r1201.
> b) opcodes: setfile "file"
> setline line
What, no set-column? :-)
> 3) the "last" Continuations
Understood, will fix along with the AST refactoring.
> 4) substr shortut
Thanks, implemented as r1203.
> Please let us know, what else is needed in the near future.
I will definitely collect issues raised during my tomorrow's
YAPC::Taipei talk and get back to you.