Compilers and Interpreters

Authored by: Kenneth C. Louden , Ronald Mak

Computing Handbook

Print publication date:  May  2014
Online publication date:  May  2014

Print ISBN: 9781439898529
eBook ISBN: 9781439898536
Adobe ISBN:

10.1201/b16812-77

 Download Chapter

 

Abstract

Compilers and interpreters are language translators that have many functions in common, in that both must read and analyze source code. A compiler, however, produces a program equivalent to the source program in a target language, usually in object or assembly code but also sometimes abstract machine code such as Java virtual machine (JVM) code or even C code, whereas an interpreter directly executes the source program. Any programming language may be either compiled or interpreted, but languages with significant static properties (e.g., FORTRAN, Ada, and C++) are almost always compiled, whereas languages that are more dynamic in nature (e.g., LISP and Smalltalk) are more likely to be interpreted. Languages that differ substantially from the standard von Neumann model of most architectures (e.g., PROLOG) may also be interpreted rather than compiled. A performance penalty is incurred by interpretation over compilation, so in cases where speed is critical, compilation is to be preferred. By mixing compilation and interpretation, this performance penalty can be reduced, usually to well within an order of magnitude. The advantage to interpretation is that the compilation step is avoided (useful during program development), and an interpreter offers greater control over the execution environment (useful for complex run-time environments) and greater flexibility in adapting to different architectures.

 Cite
Search for more...
Back to top

Use of cookies on this website

We are using cookies to provide statistics that help us give you the best experience of our site. You can find out more in our Privacy Policy. By continuing to use the site you are agreeing to our use of cookies.