Re: A Few Noob Questions [message #175181 is a reply to message #175164] |
Sat, 20 August 2011 19:52 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 8/18/2011 12:40 PM, Man-wai Chang wrote:
>>> In the old days, "Programs" were compiled into binary codes for direct
>>> execution by the CPU. "Scripts" were not compiled, but interpreted by a
>>> program called intepreter.
>>
>> Contrary to popular belief, scripts, i. e. programs written in a
>> scripting
>> language, are compiled, too. They are *JIT-compiled* *at runtime*.
>
> Is this real compilation? :)
>
Not in the same sense as an executable program. Scripting languages
like PHP and Java are compiled to an intermediate language which is
(pretty much) hardware independent. This intermediate code is then
processed by another program to generate the machine code the processor
understands. In PHP and some other scripting languages, this is done
every time the script is executed. In Java and other scripting
languages, the conversion to intermediate code is performed once and
stored in a file. The run-time processor just processes the
intermediate code.
What is classically known as "compilation" is different in that it means
the machine code itself is stored and no run-time program is required to
execute it. Languages such as C/C++, PASCAL and FORTRAN are compiled,
for instance.
>> PHP 4+ scripts are compiled by the Zend Engine (a virtual machine,
>> currently
>> Zend Engine II), to Zend Opcode, a platform-independent byte code
>> (much like
>> with Java). That byte code is interpreted by that VM.
>
> So is PHP still a script?
Yes, that's one term used.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|