Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Pre-compiled Perl?

by Anonymous Monk
on Apr 04, 2017 at 16:10 UTC ( [id://1187012]=note: print w/replies, xml ) Need Help??


in reply to Re: Pre-compiled Perl?
in thread Pre-compiled Perl?

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.)

Replies are listed 'Best First'.
Re^3: Pre-compiled Perl?
by Laurent_R (Canon) on Apr 04, 2017 at 23:07 UTC
    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.

      > 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.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        > many BASIC dialects in the 80s already "tokenized" the source in a "parsing" phase.

        On Commodore 116/16 and 64, you could even program directly in the tokens. ? was print , most others were just abbreviations like fO instead of for or oP instead of open . And when you byte-dumped the memory containing the program, it contained these instead of all the commands.

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Interesting ++. I did not know that, thank you for the information.

      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.
        > The thing about Perl is that it lets you execute Perl code during the parse.

        What do you mean?

        Macros are executed during the parse and LISP is one of the two oldest higher order languages and often copied.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found