Week 3
Week 3
INTRODUCTION
This guide is a basis for beginners in the field of program compilation
with a special focus on Java, a popular compiled language. Its goal is
to unmask the compilation process in a way that would make the
process easy to comprehend even for beginners and provide a good
starting point for further study.
PROGRAM COMPILATION
In programming, compilation is an important process where source
code in a high-level language is converted into machine code. This
process is essential as a computer can only run machine code. In
contrast to interpreted languages such as Python which are interpreted
line by line by an interpreter, compiled languages such as Java are
compiled into bytecode and can run on any system with a compatible
interpreter, the JVM.
COMPILATION PROCESS
1
WRITING THE CODE
Java code is written in .java files.
2
COMPILATION
The Java Compiler (javac) translates the Java code
into bytecode, stored in .class files.
3
EXECUTION
The JVM executes the bytecode, making the program
run.
References:
Diehl, S. (1998). A formal introduction to the compilation of Java. Software: Practice and
Experience, 28(3), 297-327.
Fulton, M., & Stoodley, M. (2007, March). Compilation techniques for real-time Java
programs. In International Symposium on Code Generation and Optimization (CGO'07) (pp.
221-231). IEEE.
APPENDIX
CODE
COMPILATION
OUTPUT RESULTS