- In an interpreted language your source code is read in command by command by a software tool, which is called the Interpreter and executed.
What ? Command-by-command ? No interpreter is using such crappy technique nowadays. --Taw
From Interpreted Language/Talk
- some languages (like Perl) are compiled at runtime
Could you elaborate ? --Taw
Every time a perl script is run, Perl compiles it and then runs the compiled code. At least, this is the usual way of using perl, although it's not the only way. --Zundark, 2001 Dec 15
You mean compile to syntactic tree or compile to machine code ? --Taw
- I believe it's compiled to bytecode, much like Java. As of perl 5.6 (version?), it's possible to produce a bytecode version of a perl program to save the compilation step. I think the bytecode can be converted back to full source as well, but I'm not as sure about that. Indigo Perl (http://www.indigoperl.com) produces a perl compiler that produces a machine executable, but I think the resulting executable consists of both the actual bytecode and enough of the perl engine to run the bytecode, so they tend to be rather large. Their advantage is being able to deploy the code to machines that don't necessarily have the Perl interpreter installed. They have versions for both Windows and Unix-ish platforms. --Wesley
Old Interpreted Language article
An interpreted language is a type of programming language that is not compiled? into [machine code]?, but is interpreted at run-time by the computer, and translated into machine understandable code as required.
It is often a mistake to refer to a language as either "interpreted" or "compiled", because
most languages can be implemented in either way, and some languages
(like Perl) are compiled at
runtime but behave as if they were interpreted.
Other languages, like Java, may be partially compiled into an
intermediate form which is then interpreted (although that, too, might be compiled).
Some languages, though, are specifically designed to favor interpretation.
An example of an interpreted language is JavaScript.
Is Java interpreted, or what?
The Java programming language article says:
- "The first implementations of the language used an interpreted virtual machine to achieve portability, and many implementations still do. These implementations produce programs that run more slowly than the fully-compiled programs created by the typical C++ compiler and some later Java language compilers, so the language suffered a reputation for producing slow programs. More recent implementations of the Java VM produce programs that run much faster, using multiple techniques."
The Java language is
compiled, always. It is designed as a compiled language, and is implemented as a compiled language. It is often compiled into bytecode, which is then interpreted (with a virtual machine). I think the Java language article is correct, but maybe it could be worded better. --LDC
Yes, and you can also compile Jave straight down to machine code if you like. The above claim that it is a mistake to differentiate between interpreted and compiled languages is IMHO incorrect; every language that has an "eval" statement which lets you construct and evaluate statements on the fly can never be cleanly compiled down to machine code; you will always have to embed an interpreter in your compiled code. --AxelBoldt