Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: TPF and Pugs

by chromatic (Archbishop)
on Dec 12, 2005 at 01:57 UTC ( #515932=note: print w/replies, xml ) Need Help??

in reply to Re^3: TPF and Pugs
in thread The Perl Foundation Wants to Hear From You

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515932]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-05-24 03:51 GMT
Find Nodes?
    Voting Booth?