Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Language Hierarchy, Phases of a Java Program

Similar presentations


Presentation on theme: "Programming Language Hierarchy, Phases of a Java Program"— Presentation transcript:

1 Programming Language Hierarchy, Phases of a Java Program
Prepared by Neal Alfie Y. Lasta IT Lecturer

2 Programming Language Hierarchy
High – Level Language (HLL) Assembly Language Machine Language Hardware

3 High-Level Language (HLL)
Closest to natural language Words, numbers, and math symbols Not directly understood by hardware “portable” source code (hardware independent) Java, C, C++, COBOL, FORTRAN, BASIC, Lisp, Ada, etc.

4 Machine Language (lowest level)
Least natural language for humans, most natural language for hardware Just 0s and 1s Directly understood by hardware Not portable (hardware dependent)

5 Assembly Language A more or less human readable version of machine language Words, Abbreviations, letters and numbers replace 0s and 1s Easily translated from human readable to machine executable Like machine code, not portable (hardware dependent)

6 Getting from Source Code to Machine Code
“Compiling a program” – translating from a high-level language source code to machine (object, or executable) code “Compiler” – a program that translates HLL source code to machine (object, or executable) code “Assembly” – translating from assemble language source code to machine (object, or executable) code Assembler – a program that translates assembly source code to machine (object, or executable) code Compilers need to know the specific target hardware

7 Compilers vs Assemblers vs Interpreters
Compilers and Assemblers Translation is a separate user step Translation is “off-line” i.e. not at run time Interpreters Another way to translate source to object code Interpretation (from source to object code) is not a separable user step Translation is “on-line” i.e. at run time

8 Compiler, Assembler or Interpreter
Source Code object Code

9 Java Program Translation
Both compilation and interpretation Intermediate Code: “Byte code” – similar to assembly code, but hardware independent Interpreter translates from generic byte code to hardware specific machine code

10 Java Byte Code The Java compiler does not translate your program into machine language for your particular computer. Instead, the Java compiler translates your Java Program into a language called byte-code. Byte-code -> the machine language for a hypothetical computer, which in this case, is called the Java Virtual Machine (JVM)

11 Java Virtual Machine JVM – a software implementation or runtime environment for hosting Java applications Interpreter works by translating each instruction of byte-code into machine language one after the other, rather than translating the entire byte-code program all at once Java byte-code has an extension of .class. This file can be copied to another computer and when you run your program, you do not have to recompile it anymore. That makes Java portable

12 Disadvantages: Requires both compiler and interpreter
Slower program execution

13 Advantages Portability
Same program can run on computers of different types (useful with the internet) Java compiler for new types of computers can be made quickly

14 Java Virtual Machine Data for Java Program Java Program Java Compiler
Byte-Code Program Byte-Code Interpreter Machine-Language Instructions Computer Execution of Machine-Language Instructions Output of Java Program Java Virtual Machine

15 Phases of Java See Phases of a Java Program in Book


Download ppt "Programming Language Hierarchy, Phases of a Java Program"

Similar presentations


Ads by Google