Sunday, January 17, 2010

Differences between a compiler and an interpreter

  1. A compiler first takes in the entire program, checks for errors, compiles it and then executes it. Whereas, an interpreter does this line by line, so it takes one line, checks it for errors and then executes it.
  2. In compiler, the resulting executable is some form of machine- specific binary code. In an interpreter, the resulting code is some sort of intermediate code.
  3. As a compiler executes the entire program at a time, it operates fast. Interpreter takes one line at a time and so, its tradeoff is slow.
  4. A compiler spends a lot of time analyzing and processing the program. An interpreter spends relatively little time is spent analyzing and processing the program.
  5. Program Execution is faster in compiler than in interpreter.
  6. Interaction level is high in interpreter than in compiler.
  7. In a production environment where throughput is more critical, a compiled language is preferred. Any high-level language can either be interpreted or compiled.
  8. 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.
  9. Literally, a compiler is a static interpreter. An interpreter is a dynamic compiler.
  10. Example for compiler: C, C++. Example for interpreter: Perl.
Related Posts Plugin for WordPress, Blogger...