Two General Approaches to Implementation

In this chapter, we will give a very brief overview of some of the issues involved in the implementation of object-oriented languages.

Generally speaking, languages are implemented in one of two different ways. There are compilers, which translate the source program into machine code. Here the source code is not available at run-time. Compilers are generally considered to have very efficient run-time performance.

Then there are interpreters. Here the source is translated into an intermediate representation, which is then simulated at run-time. Interpreters generally have the source available at run-time, which permits them to give better error reporting. However, generally people think that interpreters have slower run-time performance than do compilers.

Now, the endpoints of this distinction are clear. However, there are lots of gray areas in the middle. Most recently we have seen these in Java JIT systems, which take Java bytecodes, a classic interpreter intermediate representation, and convert it at run-time into machine code. This combines features of both compilers and interpreters.

[audio] [real] Text to accompany slide2, in Chapter 21 of An Introduction to Object-Oriented Programming