Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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.

In reply to Re^4: TPF and Pugs by chromatic
in thread The Perl Foundation Wants to Hear From You by Ovid

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (3)
    As of 2017-08-21 07:02 GMT
    Find Nodes?
      Voting Booth?
      Who is your favorite scientist and why?

      Results (318 votes). Check out past polls.