how do you make perl to c++ translater

U

Uri Guttman

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

yes. you write it.

uri
 
C

ccc31807

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.
 
P

Peter J. Holzer

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
 
S

sln

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
 
M

Martijn Lievaart

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
 
P

Peter J. Holzer

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".
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,084
Latest member
HansGeorgi

Latest Threads

Top