Re:PHP: why GOTO instead of recursion?
by Implicated on Tuesday September 23, 2014 @12:03PM
(#8356004)
I stand corrected. Compiler.
[ Parent
| on HN ]
Re:PHP: why GOTO instead of recursion?
by kyberias on Tuesday September 23, 2014 @12:09PM
(#8356036)
Compiler.
You should not be getting downvoted. The article is clearly discussing the compiler. Compilers and interpreters are not mutually exclusive. Just because a compiler produces bytecode (virtual instructions) instead of machine instructions (like x86), doesn't somehow make it not a compiler.
Re:PHP: why GOTO instead of recursion?
by astrodust on Tuesday September 23, 2014 @12:51PM
(#8356335)
Exactly. A compiler transforms abstract source code into machine-readable instructions.
These machine-readable instructions can be executable directly, but not necessarily. Is a cross-compiler not a true compiler because you can't execute the resulting code directly? Not at all. So by the same token, one that produces byte code is no different.
Re:PHP: why GOTO instead of recursion?
by kyberias on Tuesday September 23, 2014 @02:16PM
(#8357050)
I'll argue with myself here a bit if you allow... When considering PHP, we can think of The PHP Interpreter as a hybrid of two components: 1) a translator/compiler and 2) a bytecode interpreter. Therefore, when someone says "PHP Interpreter" he may indeed refer to that hybrid. If this is true, it would cause these kind of confusions. ;)
Re:PHP: why GOTO instead of recursion?
by astrodust on Thursday September 25, 2014 @04:57PM
(#8369703)
Yeah. I'd suggest that most "interpreters" today consist of a compiler and a virtual machine that runs those instructions. Historically, the earliest interpreted languages had a parser which immediately executed whatever it discovered, like BASIC, where each line was an independent statement that was parsed and executed.
It didn't take long for this to prove itself to be terribly inefficient.