Program Implementation - Low & High Level & Generations of Computer Languages
Program Implementation - Low & High Level & Generations of Computer Languages
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
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