Is there a way to compile Perl scripts using Strawberry Perl?
10 replies to this topic
#1
Posted 30 March 2011 - 05:08 AM
|
|
|
#2
Posted 30 March 2011 - 08:45 AM
There's no such thing as a Perl compiler. Perl is an interpreted language. You can get an interpreter for it here. As for Strawberry Perl, I've never heard of it, so I can't help you with that, but with most interpreters you just go to the CLI and type the name of the interpreter and then the name of the source file and it runs the program.
Programming is a journey, not a destination.
#3
Posted 30 March 2011 - 07:26 PM
Programming Perl, 3rd Edition: Chapter 18: Compiling
That page says that the Perl interpreter is a compiler. Or is it talking about a different type of compiler?
How does a perl work, anyway?
That page says that the Perl interpreter is a compiler. Or is it talking about a different type of compiler?
How does a perl work, anyway?
#4
Posted 30 March 2011 - 08:32 PM
It can compile but it is not considered what you may think of a compiled language. As I am sure the page you linked to writes, you will notice there is a lexer and parser to scan the Perl script and then generate operation codes (opcodes) which are machine language instructions, which in its compiled form is ran in the interpreter (it interprets the machine language instructions from the operation codes, rather than interpreting the textual script itself)
There lays a C compiler named B::C if I recall to generate a C table based on the operation codes, although that is not really a direct conversion, although it may suffice if you wish for an executable of the Perl script without the interpreter, I believe that is what you can do with it.
There lays a C compiler named B::C if I recall to generate a C table based on the operation codes, although that is not really a direct conversion, although it may suffice if you wish for an executable of the Perl script without the interpreter, I believe that is what you can do with it.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#5
Posted 30 March 2011 - 08:40 PM
So the Perl interpreter compiles the script and then simulates the processor?
#6
Posted 30 March 2011 - 08:53 PM
That is basically correct, it interprets your textual code in to machine compatible operation codes which can be run by the processor.
You can use a Perl module to actually visualize what those opcodes will be after parsing:
B::Concise - perldoc.perl.org
You can use a Perl module to actually visualize what those opcodes will be after parsing:
B::Concise - perldoc.perl.org
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#7
Posted 30 March 2011 - 09:01 PM
Is that output text assembly language? Or is it just a map of what the opcodes would do?
And the other thing, are the opcodes for Intel processors?
And the other thing, are the opcodes for Intel processors?
#8
Posted 30 March 2011 - 09:05 PM
In this case they are simply opcodes for the interpreter to work with, so it does not have to deal with any logic or interpretation of the code, it just performs it. You would need to do much more to get assembly out of it, and when you do it will be big (and confusing, as the interpreter needs to do a lot of work and optimizations during conversion)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#9
Posted 30 March 2011 - 09:07 PM
So are those special Perl opcodes, for the the Perl processor emulator?
#10
Posted 30 March 2011 - 09:39 PM
Yes, although it is not really considered emulating, just interpreting directly in to some form of finished machine code that supports the opcode's actions to be ran.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#11
Posted 04 April 2011 - 01:50 PM
It's more like Java's bytecode, from my understanding. So no, it can't be run directly on a machine, but it's portable as long as you have a Perl interpreter.
sudo rm -rf /
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









