There might be a third (first
I think an interpreter is just a combination of some of these.
Moderator: General Moderators
If Alan Turing were here he'd say you guys are talking about "swimming" submarines. (You're simply talking about a concept that makes no sense to begin with). A language is just a language. It is the words on your screen, not the php.exe that is the ONE POSSIBLE implementation of that language. Facebook just made a PHP compiler. It compiles from PHP to native machine code thru an intermediate C++ format. Also what about zend opcode cache? Thats another implementation of PHP (proving the language and the implementation are not a 1:1 relationship).How many freaking C++ compilers are there for example?. The language and the language's possible implementations are two different concepts. You can only classify the implementation as compiled/not compiled. And even then it doesn't make sense to do so.Higher-level programming languages are generally divided for convenience into compiled languages and interpreted languages. However, in practice there is rarely anything about a language that requires it to be exclusively compiled, or exclusively interpreted; ..snip..Modern trends toward just-in-time compilation and bytecode interpretation at times blur the traditional categorizations of compilers and interpreters.
You've nailed it (except you need to specify the particular implementation, otherwise this statement is incomplete).josh wrote:I would say "PHP is a language that compiles into a standardized op code which are then interpreted by a server module designed to interpret said op code".
I didn't say it always has to be a machine code output. You said "Give me any compiled language and I will tell you a machine it is not "native" on. " That's what I argued about. Don't blame me for words said by yourself.josh wrote:Vladsun, in order to be a compiler it doesn't have to output native machine code. Period.
Apparently, people distinguish between compiled, interpreted and scripting *languages*...A compiled language is a programming language whose implementations are typically compilers (translators which generate machine code from source code), and not interpreters (step-by-step executors of source code, where no translation takes place).
Do you really think I missed that part?!?josh wrote:"whose implementations are typically"
Did you miss that part?
Nothing really. But the compilers it talks about are useful. Languages and implementations (compilers or interpreters) are totally distinct.VladSun wrote:What about the "PHP is a compiled language since PHP 4.0" in the PHP classes blog you pointed to??? WTH does it mean???
And I call anything not bracketed "ugly", its just an opinion. One that many people might disagree with. If you have compiled and interpreted code in that language, then obviously the terms are moot, or the language is both. In either of those cases the terms have lost all practical meaning. You call it interpreted because that is the method you associate with historically. Someone who has always compiled it might call it compiled.VladSun wrote:Though, I have compiled Perl code several times, I'll always call Perl an interpreted language...
They are terms left over from previous decades before people at large started to grasp the true portability of languages.VladSun wrote:quote language classification has become somehow meaningless, but it will take some time before it's accepted by the IT community (including me).
Are there even compilers in any language that support eval? C++ doesn't have an eval function, it is still compiled. Why must a PHP->C++ compiler support eval if C++ does not? Sounds like an arbitrary requirement.M2tM wrote:just that so far I am unaware of any compilers that translate PHP into anything other than opcode which supports this feature.
Why -must- a PHP compiler support eval? I don't suppose it must except that it is in the language. I do not understand what point you are trying to make by suggesting C++ does not support an eval function, the language was never specified to include dynamic interpretation of itself as PHP was.josh wrote:Are there even compilers in any language that support eval? C++ doesn't have an eval function, it is still compiled. Why must a PHP->C++ compiler support eval if C++ does not? Sounds like an arbitrary requirement.M2tM wrote:just that so far I am unaware of any compilers that translate PHP into anything other than opcode which supports this feature.