Getting the Best of Both Worlds

Posted: July 5, 2011 in Graduate School, Java, Programming Languages

This entry is a response to the online assignment of our Graduate School for Interpretation and Compilation

Is there a programming language that does both interpretation and compilation?

The answer is a big YES.

This was made possible by the Java Programming Language who first compiles a text code in order to represent it to its equivalent code that the virtual machine can understand and then interprets it upon execution. The said sequence is shown in this diagram:

This diagram shows the compilation and interpretation done by the Java programming language. The developer writes a code in a text editor and saves it in a file with an extension of “.java”. The created java file is now compiled to the “machine” code called as “bytecode” for the Java Virtual Machine to understand. The JVM then simulates a processor then executes the bytecode instructions. The java file now is converted into a new file with an extension of “.class”. The class file is now interpreted by the Java interpreter that converts the bytecode into the machine language of the particular computer

Thus, Java does both compilation (for some degree of code optimization) and interpretation (for portability). This kind of implementation is known as “Hybrid Implementation”

Isn’t it great?

Web Reference:

  • http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Supplements/Chapter01/interpreterCompiler.html

Reference:

  • BALAGTAS, FLORENCE TIU (2005). INTRODUCTION TO PROGRAMMING I Version 1. Java Education and Development Initiative, 22-24.
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s