Java TOPIC 02 – CONVERSION TO MACHINE
LANGUAGE LESSON NOTE MACHINE LANGUAGE Computer CPUs only understand a
specific language consisting of only 0s and 1s called the machine language. PCs (IBM-compatible machines) have a
different machine language than MACs and Sun machines. Similarly, different
types of smartphones have different machine languages. This means that a computer program
that works on one type of machine isn’t compatible with another type of
machine. For example, the command represented
by the sequence 0001 0011 might mean addition
on one system but mean store to memory
on another. HIGH-LEVEL
PROGRAMMING LANGUAGES
For humans, programming with 0s and 1s
is simply RIDICULOUS! If you ever
wanted a quick way to get a headache, this would be a good start. For the most part, anything but very
simple applications are done using high-level programming languages (or simply programming languages). Examples of such languages include Java,
Turing, Fortran, C++ and VB. SOURCE
CODE Source code consists of all of the
statements that one writes to create a program. All source code for a program is stored
inside of a file. CONVERSION
The problem with programming languages
is that CPUs don’t understand them.
They only understand machine language.
Therefore, a conversion is needed to transform source code into
machine language.
1 – Compilation
2 – Interpretation
3 – Hybrid approach COMPILATION
In this process, a software program
called a compiler converts source
code to machine language. Usually,
this appears in the form of an EXE file.
INTERPRETATION
In this process, a software program
called an interpreter takes one
line at time from your source code, converts it to machine language, has it
executed by the CPU and then returns for the next line of source code. PROS AND CONS
HYBRID
APPROACH
This process is not commonly
used. However, we will look at it
because Java uses it. During the second step, an interpreter
program called the Java Virtual
Machine interprets one line of bytecode at a time. |