Reverse Engineering/Other Compilers< Reverse Engineering
This chapter will contain a listing of compilers for languages that do not warrant their own chapters. Some language implementations are significantly unique in certain aspects that they do deserve their own discussion. In the event that a section on any given language becomes large enough, it should probably be separated out into its own chapter. If no languages get listed here, perhaps we will just delete the entire chapter.
Using the utility "perlcc" program (supplied with the Perl interpreter), a user can optionally attempt to compile the Perl code into any number of other forms. These other forms include C source code (although the C code is very hard to follow), native code, and Perl bytecode.
The perlcc C code output often consists of a series of symbol tables, and calls to internal Perl functions, so the reverser would simply not find these to be of much use. The Perl bytecode however is a little more interesting, but still not easy to read by any stretch of the imagination.
The entire Perl cross-compiler suite is listed as being "very experimental", so only advanced users should put any stock in the process.
To compile a Perl script into bytecode:
perlcc -B <filename>
The bytecode should be self-executing, or it should be able to run by passing it as an argument to Perl.
To compile a Perl script into C:
perlcc -O <filename>
perlcc -c <output file> <input file>
The -O option uses the "optimized C backend" which is considered to be the most experimental component of the entire suite.
It is unlikely that too much Perl will be considered throughout the rest of this book.
- Wikibooks: Perl