I'm sure you are referring to the B::C suite with perlcc
which came with perl until 5.8.9. Since then I took over the development of the perl compiler which was not enhanced since 1997, and fixed most of the remaining bugs.
Why does perl have separate compiler and frontend?
First of all (for the others): perl is the only official frontend for perl, the interpreter.
perlcc
is the frontend for the compilers B::C
, B::Bytecode
(-B) and B::CC
(-O), the C linker part is in cc_harness
also.
Nobody really wants to mess with the various options for the backends. Using perlcc
is much easier.
Like gcc
as driver for all the backends and intermediate steps. gcc has for all intermediate steps also different executables:
cc1, cc1plus, collect, as, ld
Do you want to call cc1
by your own? I never saw this.
Does this answer your question sufficiently?
BTW, basically all answers before were complelety wrong and nobody answered Lazer's question directly.
@briandfoy: perlcc is not a dead tool, it is in steady development, and it is used in production code. Startup times are dramatically faster. You can ship single executables. 90% of normal perl works.
You could also use .pmc (as python does), but only huge sites do that.
I recommend to use the version from CPAN.
perlcc basically creates a dump at CHECK time, and executes the dump then. So there are semantical differences to perl packers (PAR, perl2exe, perlapp), which create dumps and execute them before BEGIN. See perlcompile.pod from B::C on CPAN.
@mkb: perlcc support did not languish. p5p was just not capable enough to fix the remaining bugs. So I did. See http://search.cpan.org/dist/B-C/.
@Chas: Of course does perl5 compile down to some sort of "bytecode", the optree. The B::Bytecode compiler can be used to dump this, and the ByteLoader is used to run it.
There also MAD which dumps to XML.
And there's -u which dumps to a binary representation. Which can be used to undump
to an exe. Just a simple linker-like step is necessary, for which I had no time yet.
@Novikov: Perl compiles to bytecode, and then runs this. As most scripting languages do. Perl has perlcc so you compile it to native executables.
@zigdon: You mixed that up with packagers, like perl2exe and PAR.
Maybe we have that mess because of the still wrong entry of the perl compiler in the FAQ.