Interpreters - will read your "program" - work out what you want to do - then do it. You generally put all your commands into a file (called a program) and pass it to the interpreter to run. Sometimes you can simply enter a command to be interpreted.
BASIC programs are generally interpreted but you could also view SQL or UNIX shell commands as being interpreted.
Compilers - turn your programs (MyProg.c) into a lower level commands that the computer can easily understand (MyProg.exe). Sometimes this is machine code but these days is more likely to be something similar to
p-code - a sort of half way house. This also means that the program is usually much faster to run. Typical examples are
C and
Java programs.
Just-In-Time Compilers- run as interpreters for the most part but when they see code that is repeated often (say a big for next loop) then they will spend the time to compile that section of code so it will run much faster. In this way you get programs you can run at once from the command line like interpreters but that also run quickly like compiled programs.
Threaded language interpreters - Are another type of beast entirely - they compile everything in small individual chunks but then allow you to run any chunk at any time. There are very few examples of this but I seem to remember
Forth did this.
The wiki explains it as
Quote:
Any language can be implemented via an interpreter or compiler; there is no such thing as an "interpreted language" or "compiled language", only interpreted and compiled implementations of a language. Indeed, a single program may contain parts that are implemented via interpreter and a compiler, e.g., some Lisp systems. Nonetheless, certain languages are best known for having particular kinds of implementations, and because of this are often termed "compiled" or "interpreted" languages (although technically these terms are more accurately reserved for implementations).
Many "interpreters" today include some element of compilation as well, such as a bytecode compiler, as found in Perl and Python. In such an arrangement, source code is compiled to a more efficient intermediate form, which is then interpreted.
|
Mike