Sort of picking nits here, but AFAIK Perl5 is never really "compiled." It's executed directly from the parse tree. The parse tree is bulky and full of pointers, making it difficult to store and reload later. (Back in the day, there was a dump/undump mechanism that tried to do this, but it hasn't worked for a long time.) | [reply] |
Yeah, I understand what you mean, but, to me, creating the parse tree is a form of compilation. The difference between compiled languages and interpreted languages was meaningful 20 or 25 years ago, but that distinction is very much blurred nowadays.
Contrary to some other languages (e.g. shell, TCL, awk, makefile), Perl has clearly a compile phase and a run time phase. Whether the compile phase produces an op tree or an executable file has become to a large extent irrelevant in my view. But, yes, it's not really a compilation in the sense of what you do with a C program, you don't produce a binary executable program.
| [reply] |
> Contrary to some other languages (e.g. shell, TCL , awk,
That's not up to date:
Since version 8.4, Tcl has featured the ability to automatically translate scripts into bytecode where feasible
from http://wiki.tcl.tk/38633
It's interesting to note that one of the main arguments why TCL lost against competitors like Perl was the bad performance.
Also what they call "bytecode" here seems to be high level opcode.
That's all not very new stuff, I'm pretty sure many BASIC dialects in the 80s already "tokenized" the source in a "parsing" phase.
| [reply] |
I don't think we have any real disagreement except for terminology. A compiler translates one formal language to another. If you define the parse tree to be a language, your definition of "language" is loose enough that every data structure is a language, and that makes every program a compiler. Saying that a language is "compiled" in the old-school sense really means that it is "compiled to machine language," but as you say, the distinction is mostly unimportant these days.
Contrary to some other languages (e.g. shell, TCL, awk, makefile), Perl has clearly a compile phase and a run time phase.
All of those languages have to be parsed, so they clearly have a "parse phase." The thing about Perl is that it lets you execute Perl code during the parse. Off the top of my head, I can't think of any other language that lets you do that.
| [reply] |