0% found this document useful (0 votes)
16 views40 pages

Program Implementation - Low & High Level & Generations of Computer Languages

The document discusses the classification of computer languages into low-level and high-level categories, detailing their characteristics and examples. It outlines the generations of programming languages from first generation (1GL) to fifth generation (5GL), highlighting their unique features and uses. The document emphasizes the differences in portability, ease of use, and execution speed between low-level and high-level languages.

Uploaded by

suwayne.morrison
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views40 pages

Program Implementation - Low & High Level & Generations of Computer Languages

The document discusses the classification of computer languages into low-level and high-level categories, detailing their characteristics and examples. It outlines the generations of programming languages from first generation (1GL) to fifth generation (5GL), highlighting their unique features and uses. The document emphasizes the differences in portability, ease of use, and execution speed between low-level and high-level languages.

Uploaded by

suwayne.morrison
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

PROGRAM

IMPLEMENATION
■LOW LEVEL & HIGH
LEVEL PROGRAMMING
LANGUAGE

■GENERATIONS OF
COMPUTER LANGUAGE
Classification of
Computer Language
■Computer languages can
be classified according to
whether they are LOW
LEVEL or HIGH LEVEL.
LOW LEVEL LANGUAGES
■Are MACHINE DEPENDENT. Different
brands of computer use different program
codes and so program code written for one
brand of CPU will not run on another brand
CPU because codes are written with internal
operations and architecture of a particular
CPU in mind.
■Execute Instructions faster .
■Uses less storage space as it does not
compile any codes.
HIGH LEVEL LANGUAGES
■ Are MACHINE INDEPENDENT making them
portable as they are not specifically designed
for any one brand of computer.
■ Many computer languages have been
developed and evolved over the years.
■ Create program faster.
■ Create programs cheaper. One line of high
level language can translate to ten lines of
machine or assembly language code. The
cost of writing a program is nearly the same
for each line of code, regardless of the
language.
■ Make it easier to avoid and detect errors in
Classification of Computer
Language according to Generation
1. First Generation Language(1GL) – Low
Level Language
2. Second Generation Language (2GL) –
Low Level Language
3. Third Generation Language (3GL) –
High Level Language
4. Fourth Generation Language (4GL) –
High Level Language
5. Fifth Generation Language (5GL) –
High Level Language
1GL
■MACHINE LANGUAGE is written
using 1s and 0s, i.e. binary code.
This is the internal language of
computers. It is the only
instruction that the CPU
understands and can obey or
execute directly without having to
translate it. The physical workings
of computers rely on this system.
EXAMPLE OF 1GL
1101 1101 1011 1011

1110 0001 1100 0111

0010 1110 1011 0011


Characteristics of 1GL
■Fastest to execute as no translation is
needed.
■Use the processor and memory more
efficiently
■Difficult to decipher
■Easy to make mistakes in the sequence of
1s and 0s
■Time consuming & tedious to write
■Machine dependent and therefore not
portable
■Programming is difficult and complex
2GL
■ASSEMBLY LANGUAGE is written
using mnemonic codes. These are
short codes that suggest their
meaning and are therefore easier to
remember. These codes represent
operations, addresses that relate to
main memory, and storage registers
of the computer. Typical codes might
be: LDA, STO, ADD, NOP, etc.
EXAMPLE OF 2GL
An example of a program to add and
store two numbers would be:

LDA A, 20 load accumulator A with the value 20


ADD A, 10 add the value 10 to accumulator A
STO B, A store contents of accumulator A into
storage register B
NOP no operation (Stop here)
Characteristics of 2GL
■Easier to write than
machine language
■As with machine
language, assembly
language is machine
dependent.
3GL
■This generation of
languages was designed
so that it is even easier for
humans to understand.
EXAMPLES OF 3GL
■Pascal
■BASIC
■C
■FORTRAN
■COBOL
Pascal
■Design to be used in teaching
programming, and in business
programs.
■Developed by Niklaus Wirth, a Swiss
computer scientist in 1970, and is
named after Blaise Pascal, the 17th
century mathematician who invented
the mechanical calculator.
Example of a Pascal Program
PROGRAM Addition (Input, Output);
VAR
Num1, Num2, Sum: Integer;
BEGIN
READLN (Num1, Num2):
Sum:= Num1+Num2;
END
BASIC
■BASIC - Beginner’s All-Purpose
Symbolic Instruction Code.
■Designed for beginners to use.
Example of a BASIC Program
10 INPUT Num1
20 INPUT Num2
30 Sum = Num1 + Num2
40 PRINT SUM
C
■Developed by Bell Laboratories in
the USA (now AT&T).
■Used for both high and low level
programming.
Example of a C Program
#include <stdio.h>
int main()
{
int Num1, Num2, Sum;
scanf(“%d%d”, &num1, &num2);
Sum = Num1 + Num2;
printf(“%d”, Sum):
return 0;
}
FORTRAN
■FORTRAN – FORmulator TRANslator
■Designed for use by engineers and
scientists for complex mathematical
calculators.
Example of a FORTRAN Program
c Program to find the sum of 2
numbers
INTEGER Num1, Num2, Sum
READ (10, 20) Num1, Num2
10 Format (14, 14)
Sum = Num1 + Num2
Print, Sum
Stop
End
COBOL
■COBOL – Common Business Oriented
Langauge
■Used in business, finance and
administrative systems to
manipulate large databases, files and
business applications.
■Can be a tedious language to write
Example of a COBOL Program
IDENTIFICATION DIVISION.
PROGRAM-ID. SUM OF TWO NUMBERS.
ENVIRONMENT DIVISION.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 Num1 PIC 99 VALUE ZEROES.
01 Num2 PIC 99 VALUE ZEROES.
01 Sum PIC 999 VALUE ZEROES.
Example of a COBOL Program
Contd.
PROCEDURE DIVISION
DISPLAY “Enter First Number:” WITH NO ADVANCING
ACCEPT Num1
DISPLAY “Enter Second Number:” WITH NO ADVANCING
ACCEPT Num2
ADD NUM1, NUM2 GIVING Sum
DISPLAY “Sum is = “, Sum
END-PERFORM.
STOP RUN.
Characteristics of 3GL
■It uses English words
and symbols, and is
therefore even
■It is machine
independent
4GL
4GL languages fall into the
following categories:
1. Database query languages, e.g.
SQL (Structured Query
Language)
2. Report generators, e.g. Oracle
Report, RPG-II, RPG-III, RPG-IV
(Report Program Generator)
3. Data manipulation, analysis and
4GL (cont’d)
4. Data stream languages, e.g.
Iris Explorer
5. Screen painters and
generators, e.g. Oracle
Forms
Example of 4GL
■OPS5 (Official Production System)
■SQL
■Prolog (Logical Programming)
■Mercury.
Example of SQL Program
Code
USE STOCKLIST
SELECT ALL Items WHERE
Price > $10.00
Example of Prolog Program
Language
Dog(sparkie). (The program code “Sparkie is a dog”)
?-dog(sparkie). (Question asked “Is Sparkie dog?”)
yes. (The program returns yes)
?-dog(spot). (Question asked “Is Spot dog?”)
no. (The program returns no)
Characteristics of 4GL
■ Designed for the development of commercial
business software
■ Uses English-like statements that are very user-
friendly, hence programs are easier to write
■ Time is reduced in programming hence increasing
the speed of program development
■ Reduce the cost of software development
■ Contains BUILT IN FUNCTION to assist user in
solving problems
■ Minimize end-users’ effort to obtain information
from a computer
■ Minimize maintenance by reducing errors and
making the program codes easy to modify.
5GL
■5GLs are design to build specific
program that help the computer solve
specific problems
■5GLs are 4GLs with a knowledge base
■5GL uses a visual or graphical
development interface to create a
program that is usaully compiled with
3GL or 4GL programming language
compiler
■5GLs are used mainly in artificial
Example of 5GL
■GUI (Graphical User Interface) creator, e.g.
Visual Basic
4GL versus 5GL
■The main difference between
4GLs and 5GLs is that 4GLs are
designed to build specific
programs while 5GLs are
designed to make the computer
solve the problem for you
■All codes for 5GLs are
automatically generated.
■You must remember that, in
reality, the computer does not
understand Pascal or any of the
High level languages. Computers
work in machine code or
machine language, as we saw
earlier. A compiler or interpreter
converts the programs into the
machine language of the
computer you are using, the
language that the computer
understands. Only then can the
THE END

You might also like