a compiler for perl

Francois-Rene Rideau fare@tunes.org
Fri, 19 May 2000 19:18:12 +0200


>>: Siddhartha Jain
>> Its about can you have a compiler for perl or for that matter 
>> any scripting language?
I've heard of a perl5 compiler, but it depends on the usual perl runtime.
CommonLISP, Scheme, OCaml have been used as "scripting" languages,
and definitely have compilers.
Someone is writing a compiler for Python in OCaml (search from caml.inria.fr).
Also, if you consider that bytecode compilers are ok, then most non-trivial
scripting languages have compilers.

>> So first am i right? If yes, are there other reasons too why scripts cannot 
>> be compiled.
Because script-language writers generally do a quick&dirty job,
which is incompatible with compiler development.

>: Jecel
> Now the complex answer: depending on what reflective facilities a
> language offers, the job of a compiler can become very hard indeed!
> For example, programs in LISP have access to their own code and can
> even change it while running.
Well, depends on what LISP you're talking about (LISP 1.5 vs later),
you don't modify the source code and have the behavior of functions
explicitly change. However, you can redefine and recompile functions,
and evaluate expressions (that may be modified versions of earlier
source code). Same with perl. In all these cases, the runtime contains
a compiler or interpreter to satisfy the needs of eval users.
If the system makes it possible to detect that eval won't be used in
a given program, then it might be stripped from a static binary output
(some LISP "tree-shakers" are known to do that).

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
So you think you know how to translate french into english? Now what if the
french meant something completely different than what the english understood,
only neither the french, nor the english, could figure out the difference?