Compilation and Interpretation

Compilation

read source code (high-level language), and translate source language into machine language (low-level language) so that executable program can be made.

Pros:

  • Enable programmers to write human-readable code with a richer set of instructions
  • Program execution is fast (execution time is SHORT)
  • Compiled programs can be run more than once without re-compilation
  • Programs can be compiled for different platforms

Cons:

  • To run on a different platform, code has to be recompiled (NOT PORTABLE)
  • The write, compile, execute cycle is much longer than interpreted languages (development cycle is LONG)

Interpretation

read source code, analyze it, and execute it as it goes.

Pros:

  • No need to compile before running the program; program can just be run straight away
  • Interpreted languages are quick and usually easy to develop in. (development cycle is SHORT)
  • Program can be run on different platforms without recompiling (provided an interpreter is available for that platform) (PORTABLE)

Cons:

  • Program execution is slower than with compiled code (execution time is LONG)

Analogy

Compilation is like translating a French knitting pattern into English, then reading the English. Interpretation is like using a French dictionary on each word in turn as you knit. If there's a loop in the knitting pattern, then the latter method means you will end up retranslating the same word over and over again.

page_revision: 1, last_edited: 1226957757|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License