Interpreter Vs. Compiler
Programming languages can be divided into two major categories: low level and high level. "Assembly language" and "machine language" are called low-level languages because they more than others "speak" the language the computer understands. On the other hand, C, C++, Pascal, BASIC, Visual Basic, Java, and COBOL are high-level languages because they require more manipulation by the computer, a process called compiling.
Compiler
A compiler is a special program that processes statements written in a particular programming language and converts them into machine language, a "binary program" or "code," that a computer processor uses. A compiler works with what are sometimes called 3GL and higher-level languages (3rd-generation languages, such as Java, C, and PL/1). Typically, a programmer writes language statements in a language such as C, Pascal, or C++ one line at a time using a tool called an editor. The "edited" file contains the source statements. The programmer then runs the appropriate language compiler (there may be several compilers for each language), specifying the name of the file that contains the source statements.
When executing the file, the compiler first parses or analyzes all of the language statements syntactically in a sequential manner and then, in one or more successive passes, builds the output code, ensuring that statements that refer to other statements are referenced correctly in the final code. The code is linked to various libraries, which are common code sections found in many programs. The use of libraries helps keep redundant coding to a minimum. The compilation output is sometimes referred to as object code or an object module. (Note that the term "object" as used in this instance is not related to object-oriented programming. The object code as used here refers to machine code that the processor executes one instruction at a time.)
High-level languages are usually compiled and are not limited to any particular computer architecture. High-level languages are much easier to read than assembly language. Compiled languages are preferred by many developers because, once compiled, the program runs faster than if it were interpreted. Once a program has been compiled, it cannot easily be changed, so there's an element of security built in to compiled programs.
The Java programming language has taken code compilation one step further. Java, which is used in object-oriented programming, has introduced the idea of compiling output that can run on any computer system platform for which a Java bytecode interpreter (called a Java Virtual Machine) is provided to convert the bytecode into instructions that can be executed by the actual hardware processor. Using this virtual machine, the bytecode can be recompiled at the execution platform by a "just-in-time" compiler. What all this means is that the bytecode is platform-independent code that can be sent to any platform (Windows, MAC, Unix) and run on that platform. This is one of the principal advantages of Java: write once, compile once.
Interpreter
Interpreters translate code one line at time, executing each line as it is "translated," much the way a foreign language interpreter would translate a book, by translating one line at a time. Interpreters do generate binary code, but that code is never compiled into one program entity. Instead, the binary code is interpreted each and every time the program executes. Some examples of interpreted programs are BASIC, QBASIC, and Visual Basic (version 5 of which has both a compiler and interpreter). Where compiled programs can run on any computer, interpreted programs can only run on computers that also have the interpreter.
The Practical Extraction and Reporting Language, or Perl, is a script-based programming language whose syntax parallels that of the C language but is an interpreted language; Perl can optionally be compiled prior to execution into either C code or cross-platform bytecode. Perl is easier to learn and faster to code in than the more structured (and compiled) C and C++ languages. When compiled, a Perl program can execute almost as fast as a fully precompiled C language program. JavaScript is another example of an interpreted script-based programming language.
Interpreters offer programmers some advantages that compilers do not. Interpreted languages are easier to learn than compiled languages, which is great for beginning programmers. An interpreter lets the programmer know immediately when and where problems exist in the code; compiled programs make the programmer wait until the program is complete.
There is a third method of generating code, and that's with an assembler, which is used in Assembly language. The assembler translates Assembly language into machine language.
This is the complete article, containing 738 words
(approx. 2 pages at 300 words per page).