how do you make perl to c++ translater

Discussion in 'Perl Misc' started by Robin, Dec 30, 2010.

  1. Robin

    Robin Guest

    Does anyone have any hints as to how this would be done?

    roll,

    -r
     
    Robin, Dec 30, 2010
    #1
    1. Advertising

  2. Robin

    Uri Guttman Guest

    >>>>> "R" == Robin <> writes:

    R> Does anyone have any hints as to how this would be done?

    yes. you write it.

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Dec 30, 2010
    #2
    1. Advertising

  3. Robin

    ccc31807 Guest

    On Dec 30, 6:13 am, Robin <> wrote:
    > Does anyone have any hints as to how this would be done?


    Why would you want to do that? Why not just write your program in C++
    to begin with?

    I think an even better question would be, 'Why not have Perl compiled
    to intermediate byte code?' or, 'Why not have Perl compiled to native
    instruction sets?'

    Actually, I'm waiting for someone to attempt to implement Perl to run
    on both the JVM and the .NET platforms. Think about it ... Perl
    running as Java byte code and/or as MSIL byte code! In these times,
    much, much better than compiled as C++ source.

    CC.
     
    ccc31807, Dec 30, 2010
    #3
  4. On 2010-12-30 20:07, ccc31807 <> wrote:
    > On Dec 30, 6:13 am, Robin <> wrote:
    >> Does anyone have any hints as to how this would be done?

    >
    > Why would you want to do that? Why not just write your program in C++
    > to begin with?
    >
    > I think an even better question would be, 'Why not have Perl compiled
    > to intermediate byte code?'


    Perl *is* compiled to intermediate byte code. There just isn't any
    useful way to dump and reuse that code.

    > or, 'Why not have Perl compiled to native instruction sets?'


    Once upon a time the answer was "because it's hard to do properly and
    perl runs on many hardware platforms and you'd have to write a compiler
    for each of them". Nowadays x86 and x86_64 are probably the only
    important hardware platforms for perl, so what remains is "because it's
    hard to do properly."

    > Actually, I'm waiting for someone to attempt to implement Perl to run
    > on both the JVM


    People have talked about that ever since the Java hype began in 96.
    AFAIK nobody even seriously attempted it. So I wouldn't hold my breath.

    > and the .NET platforms. Think about it ... Perl
    > running as Java byte code and/or as MSIL byte code! In these times,
    > much, much better than compiled as C++ source.


    I'm not sure Perl fits well into these frameworks, so you would probably
    have to write some wrapper code around your Perl modules. In the other
    direction: You can already call Java from Perl, probably .NET, too.

    Instant access to any improvements in interpreter technology (especially
    JIT) might be an advantage, tough.

    hp
     
    Peter J. Holzer, Dec 30, 2010
    #4
  5. Robin

    Guest

    On Thu, 30 Dec 2010 12:07:32 -0800 (PST), ccc31807 <> wrote:

    >On Dec 30, 6:13 am, Robin <> wrote:
    >> Does anyone have any hints as to how this would be done?

    >
    >Why would you want to do that? Why not just write your program in C++
    >to begin with?
    >
    >I think an even better question would be, 'Why not have Perl compiled
    >to intermediate byte code?' or, 'Why not have Perl compiled to native
    >instruction sets?'
    >
    >Actually, I'm waiting for someone to attempt to implement Perl to run
    >on both the JVM and the .NET platforms. Think about it ... Perl
    >running as Java byte code and/or as MSIL byte code! In these times,
    >much, much better than compiled as C++ source.
    >
    >CC.


    Utterly, fascinating .. Win32 just gone single digit years. Ah, but
    still, half of the process space goes to the Kernel, or I guess in
    64 bit, it is going to gobble only 2 gig of address space. You never
    know though, a single bit controlled that space. Meanwhile, the kernel
    never changes its core. The kernel constructs remote procedure calls,
    a transport mechanism and everything else provieded to the application,
    that would be everything! Nothing ever changes, Unix/Windows/OS2 ...
    When was the last time you heard "Microsoft announces a new OS based on
    a completely different core (Kernel)? In that regard, you can find your
    Perl core assembly in its compiled state, based on your hardware and OS
    preference... Cheers!

    -sln
     
    , Dec 30, 2010
    #5
  6. On Thu, 30 Dec 2010 21:51:25 +0100, Peter J. Holzer wrote:

    > Once upon a time the answer was "because it's hard to do properly and
    > perl runs on many hardware platforms and you'd have to write a compiler
    > for each of them". Nowadays x86 and x86_64 are probably the only
    > important hardware platforms for perl, so what remains is "because it's
    > hard to do properly."


    So I must be doing something wrong with my Perl programs on PowerPC?

    (Hint, AIX is alive and kicking)

    M4
     
    Martijn Lievaart, Dec 31, 2010
    #6
  7. On 2010-12-31 10:24, Martijn Lievaart <> wrote:
    > On Thu, 30 Dec 2010 21:51:25 +0100, Peter J. Holzer wrote:
    >> Once upon a time the answer was "because it's hard to do properly and
    >> perl runs on many hardware platforms and you'd have to write a compiler
    >> for each of them". Nowadays x86 and x86_64 are probably the only
    >> important hardware platforms for perl, so what remains is "because it's
    >> hard to do properly."

    >
    > So I must be doing something wrong with my Perl programs on PowerPC?
    >
    > (Hint, AIX is alive and kicking)


    Yes, we considered buying a mid-range p-series system last year. The
    Power architecture is especially interesting for Perl because it
    supports base-10 floating point in hardware (though the perl port
    doesn't take advantage of it yet, AFAIK).

    But in pure numbers Power (and Sparc) are probably negligible compared
    to x86-based systems (I have no idea about ARM - the market is huge, but
    I don't think Perl is very popular on embedded systems). This is very
    different from the mid-1990's, when PowerPC, Sparc, Alpha, MIPS, PA-RISC
    and x86 all had roughly similar market shares on systems running perl.

    So today, if somebody writes a compiler which works only on x86 and
    x86_64, I think it would have a good chance of being accepted into the
    core because it covers 90+% of the perl installations. If you want to
    use Perl on Power, you'll be stuck with the good old interpreter - tough
    luck.

    hp

    PS: There is a JIT compiler for Perl
    (http://search.cpan.org/~rurban/Jit-0.04_09/), but it's in a very
    early stage of development (doesn't even do loops yet). According to
    Reini it's "really simple, just a lot of work".
     
    Peter J. Holzer, Dec 31, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doris Cox
    Replies:
    0
    Views:
    562
    Doris Cox
    Dec 2, 2003
  2. Dennis
    Replies:
    0
    Views:
    706
    Dennis
    Dec 2, 2003
  3. Replies:
    15
    Views:
    1,019
    Roedy Green
    Nov 12, 2005
  4. Replies:
    1
    Views:
    375
    Jonathan Wood
    Jun 18, 2008
  5. red
    Replies:
    6
    Views:
    117
Loading...

Share This Page