Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Languages Generations

Similar presentations


Presentation on theme: "Programming Languages Generations"— Presentation transcript:

1 Programming Languages Generations
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Generations Intelligent Languages Non-procedural Languages 5GL Procedural Languages 4GL 3GL Assembly Language Faculty Notes: Programming language evolution is categorized into five language generations based on the time of the language development and the level of advancement. First generation languages are very close to the language of the computers. As languages have evolved they have become more ‘human like’. First generation (1GL): Machine Language Second generation (2GL): Assembly Language Third Generation (3GL): Procedural languages Fourth Generation (4GL): Nonprocedural languages Fifth Generation (5GL): Intelligent languages This module provides an overview of the language generations. 2GL Machine Language 1GL 1 Copyright © Accenture 2012

2 Programming Languages Levels: Overview
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Overview Low Level Machine specific Fast execution Difficult programming and debugging Long code Machine Language (1GL) Assembly Language (2GL) High Level Human language like Slower execution Easier programming and debugging Shorter code Procedural languages (3GL) Non-procedural languages (4GL) Intelligent languages (5GL) Faculty Notes: Machine Language and Assembly Language were the first programming languages. They are called low level languages because the programming is done in code that is understood by a specific computer. Program execution is very fast and efficient. Programming is tedious and complex. Instructions/commands are specific to the particular CPU or microprocessor family on which the program will run. Code is written for the lowest level of computer hardware such as registers, RAM, processors, etc. The code must be rewritten to run on each computer / computer architecture. Programs potentially contain more errors than high level language programs. More programming statements are required for a task such as adding two numbers. There is no translator between the programmer and the computer. Over the years programming languages have evolved into languages that are more easily understood by humans. These are known as high level languages. High level languages include statements and commands that tell the computer the desired results. Programs can be run on a number of different computers without rewriting the code. Programmers use natural, i.e. human, language to communicate with the computer. Program execution is slow compared to low level language programs. High level language programs are transformed into machine code before they are read and executed by the computer. 2 Copyright © Accenture 2012

3 Programming Languages Levels: Machine Language
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Machine Language Only language understood by computers Does not resemble human language Hardware specific Difficult to read and write Sequence of bits Faculty Notes: Machine language, a first generation language (1GL), refers to the set of machine codes used to run a program on any given computer. There is no one set of machine language instructions that runs on all computers. The machine code needed to run a program is different for each type of computer. A program in machine code for an Intel x86-based PC will not run on an IBM mainframe computer, and vice versa. Machine language is the only language understood by computers. All high level languages and assembly language code must be converted into machine language for a computer to process the instructions. 3 Copyright © Accenture 2012

4 Programming Languages Levels: Machine Language Example
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Machine Language Example 55 89 e5 53 83 ec 04 e4 f0 e8 31 00 c3 2a 39 74 10 8d b6 7e 13 29 75 f6 1c 24 6e 8b 5d fc c9 d8 eb 90 Faculty Notes: This machine language code set calculates the greatest common divisor (GCD) of two integers. This example is machine code for the x86 (Pentium) processor. This is machine code that has been shortened and represented in hexadecimal. The instructions are expressed as hexadecimal (base 16) numbers (such as e5 and ec) which represent the binary code. For more information see: Programming Language Pragmatics, Third Edition by Michael L. Scott. Chapter 1 - Introduction Machine code to calculate the greatest common divisor of two integers for the x86 (Pentium) instruction set. 4 Copyright © Accenture 2012

5 Programming Languages Levels: Assembly Language
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Assembly Language Hardware specific Mnemonic symbols Represent machine code instructions Example: Add two numbers ADD R1, R2, R3 Requires translator Assembler Maps mnemonics to machine instructions and data Faculty Notes: Assembly languages, second generation languages (2GL), use the same instruction set as machine languages and are specific to the type of computer used to run the program. Unlike machine languages, assembly languages begin to resemble human language providing meaningful names and abbreviations for operations. These names, known as mnemonics, are a symbolic representation of a computer's binary encoding (machine code). For example: the assembly language mnemonic ADD represents the instruction to add two numbers together and produce a sum. Because assembly languages use representative symbols and computers only understand machine code, a translator is needed to convert assembly language to machine code. The translator is known in computer terms as an assembler. The assembler translates assembly language into machine code (binary instructions). The translation maps the assembly language mnemonic statements into machine instructions and data. 5 Copyright © Accenture 2012

6 Programming Languages Levels: Assembly Language Example
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Assembly Language Example pushl %ebp jle D movl %esp, %ebp subl %eax, %ebx %ebx B: cmpl $4, %esp jne A andl $-16, %esp C: %ebx, (%esp) call getint putint -4(%ebp), %ebx leave ret je C D: %ebx, %eax A: jmp B Faculty Notes: This assembly language code, like the machine language example, calculates the greatest common divisor (GCD) of two integers using the x86 (Pentium) processor. The code is beginning to resemble human language using familiar symbols and words. The code, though longer than the machine language equivalent, is still quite terse and difficult to read without training using the x86 assembly language. For more information see: Programming Language Pragmatics, Third Edition by Michael L. Scott. Chapter 1 - Introduction Assembly language code to calculate the greatest common divisor of two integers for the x86 (Pentium) instruction set. 6 Copyright © Accenture 2012

7 Programming Languages Levels: High Level
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: High Level Computer architecture/hardware independent Portable Resembles natural/human languages Easy to read, write, maintain Require translator Compiler Maps statements to machine instructions and data Faculty Notes: High level languages (third, fourth and fifth generation - 3GL, 4GL, 5GL) use human language type statements to express the tasks to be performed, such as computations. Because high level languages use expressive statements rather than machine code a translator is needed. In high level languages the translator is known as a compiler. The compiler maps the high level statements into machine instructions and data. More about compilers and the compilation process is seen later in this module. Comparing high level languages to Assembly Language and Machine Language: High level language programs are easier to write, read and debug. Assembly Language and Machine Language programs are smaller, in terms of lines of code and execute more quickly. The decision on which language to use is dependent, in part, on the trade off between speed of development and speed of execution / program size. 7 Copyright © Accenture 2012

8 Programming Languages Levels: High Level Language Example
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: High Level Language Example Faculty Notes: Though not the type of language used to communicate between humans, this C language code is much easier to understand than the low level Machine Language and Assembly Language code. All high level languages provide similar types of programming statements that can be run on any computer that supports the given language. The programmer is released from the concerns of the specific hardware platform or computer architecture on which the program will be run. For more information see: Programming Language Pragmatics, Third Edition by Michael L. Scott. Chapter 1 - Introduction High level language (C language) code to calculate the greatest common divisor of two integers. 8 Copyright © Accenture 2012

9 Programming Languages Levels: Abstraction
ADF 2.0: Java: Programming Languages, Levels and Paradigms Programming Languages Levels: Abstraction What is abstraction? Focus on high level rather than implementation details. What does it mean to high level languages? Program statements do not deal with specific computer architecture. Programming efficiency. Faculty Notes: Abstraction allows the programmer to write statements telling the computer what needs to be done without directly dealing with the computer architecture. Unlike Machine Language where the programmer specifically writes to the computer registers, memory addresses and call stacks, high level languages provide programmers tools, known as constructs, including variables, arrays, and expressions to communicate with the computer’s hardware and internal memory architecture. Later modules in this course examine these and other programming constructs in greater detail. What sort of statements are used in high level languages? Variables Arrays Expressions Procedures, subroutines, functions 9 Copyright © Accenture 2012

10 Compilation Machine Code: Executable
ADF 2.0: Java: Programming Languages, Levels and Paradigms Compilation Machine Code: Executable Compiler High Level Language Machine Code Faculty Notes: A compiler translates the high level source programs into machine language code. Compilers are software programs designed for specific high level languages. Each language must be compiled (translated) by a program that ‘speaks’ both the high level language and the language of the computer on which the program is to run. There are two types of compilation – machine code generation and intermediate representation: Machine code generation is the original mode of compilation developed during the early days of high level languages. In truly compiled languages the compiler directly and completely transforms the high level language statements to machine native code. The machine code is directly executed on the target hardware / computer system. Compiler: Hardware specific translation software. Machine Code Generation: High level source code translated directly into machine language. 10 Copyright © Accenture 2012

11 Compilation Bytecode: Interpreted
ADF 2.0: Java: Programming Languages, Levels and Paradigms Compilation Bytecode: Interpreted Compiler Interpreter High Level Language Bytecode Machine Code Faculty Notes: Intermediate code representations and execution time interpretation have been developed to improve programming efficiency. The interpretive compiler translates high level source code into bytecode or some other intermediate representation of the code. Bytecode is a sequence of instructions that can be further interpreted and converted into machine code. While not executable, the intermediate code closely resembles machine code. The intermediate code is saved and quickly interpreted or further compiled at the time of execution. At the time of program execution the hardware specific interpreter translates the intermediate code, one line at time, into machine code and executes the code line as it is translated. Examples of interpreted languages include BASIC, QBASIC, and Visual Basic (version 4 and lower). Intermediate representation: High level source code translated into bytecode Interpreter: Translation / execution software 11 Copyright © Accenture 2012

12 ADF 2.0: Java: Programming Languages, Levels and Paradigms
Compilation Java Javac Compiler Java Source Code Bytecode Machine Code Faculty Notes: Java uses the Javac ‘Just in Time’ (JIT) compiler JIT compilers create the bytecode once and the compiled code is saved using a ‘.class’ extension. The saved code is available each time the program is run thus speeding up program execution. Early Java compilers translated the bytecode to machine code each time the program was run. Modern compilers cache the machine code for reuse at the time of program execution. Javac compiler: Executable bytecode - filename.class Java classes and bytecode loaded on first usage. Stored in cache for future use. 12 Copyright © Accenture 2012


Download ppt "Programming Languages Generations"

Similar presentations


Ads by Google