Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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.


Comment on Re^4: TPF and Pugs
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-09-22 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls