You are on page 1of 39

Foreword HIGH AND LOW LEVEL

LANGUAGES

Computer science is rapidly revolutionizing our society. Looks like


everything will be digital by 2k50.It is necessary for students as well as
common people to know it’s applications to compete in the digital world.

High-level languages and low-level languages play a very important role


in the field of computer science. This booklet will be very helpful for
students to understand the concept of high and low-language in detail.

Key-Features
• Complete concept about Machine-Language and Assembly-Languages

• Complete concept about procedural ,OOP and non-procedural-Languages

Contact us:

[202-RB-Gatti –Faisalabad]

Phone: [+92311-7577374]
Booklet written by:
Email: [workstation6762@gmail.com]
Muhammad Hussnain Khan
Table of Contents DO YOU KNOW?
Programming Languages ....................................................................3
Machine Language
Low Level Languages ........................................................................4 In 1883 Ada Lovelace created an Algorithm
for the Charles Babbage’s Analytical Engine to
Machine Languages ........................................................................4 compute Bernoulli numbers. It is considered to
be first computer programming language.
Assembly Languages ....................................................................4

High Level Languages ........................................................................7

Procedural Languages ......................................................................8


Assembly Language
Object-oriented Languages .........................................................19 Assembly language is a type of low-level
programming language that is invented to
Non- procedural Languages .............................................................29 communicate directly with a computer’s
hardware. Assembly language is created in
1949 by Kathleen Booth. It allows complex
jobs to run in a simpler way.

#Python
Python is an object-oriented, high-level
programming language used in major fields
including Machine Learning and AI, Web
Development, Data Analytics, Game and
Application Development etc. Python ranked
#1 in Jun 2022 listed by TIOBE

2
Programming Language Types of program languages

Different programming languages are available for writing different types of


programs. Some languages are specially used for writing business Low-level language
programs and some are used for writing scientific programs etc.
Low-level languages are near to computer
Programming language can be defined as: hardware and far from human languages.
Computer can understand these languages
• A set of words, symbols and codes used to write programs is called easily. Writing a program in low-level-languages
program language. requires a deep knowledge of the internal
or structure of computer hardware.
• An artificial language that can be used to control the functioning
of a machine, particularly a computer is called program language.

or
High-level language
High-level language is close to human languages
• A vocabulary and set of grammatical rules for instructing a and are easy to understand. Instruction of these
computer or computing device to perform specific tasks is called languages are written in English-like words such as
programming language input and print etc. A program written in high-level-
language is easier to write and modify.

“First solve the problem. Then, write the code.”

John Johnson

3
Low-level languages
A low-level programming provides little or no abstraction from computer’s instruction set architecture-commands or functions in the language map

that are structurally similar to processor’s instruction. Because of low abstraction between the language and machine language, low-level languages

are sometimes described as being “close to the hardware”.

1. Machine Language
A type of language in which instructions are written in binary form is called machine language. It is the only language that is directly understood by the

computer. It is the fundamental language of computer. Program written in machine language can be executed very fast by the computer. Programs written

in machine language are machine-dependent. Every computer has it’ s own machine language. Machine language is difficult to understand. Writing and

modifying program in machine language takes a lot of time. Machine language is also known as “first generation language”.

2. Assembly Language
Assembly language is a low-level language. It is one step higher than machine language. In assembly language, symbols are used instead of binary code.

These symbols are called mnemonics. For example, Sub instruction is used to subtract two numbers. Assembly language is also called symbolic language.

Programs are written in assembly language are easier to write and modify than machine language. Assembly language is mostly used for writing system

software. Assembly language is also known as second generation language.

4
EXAMPLES

Models

5
DO YOU KNOW?

It is real pic of world’s first stored computer program code. The Analytical Engine was a proposed mechanical general-

purpose-computer by computer pioneer Charles Babbage.

7 Analytical Engine (1837)

6
High-level languages
In computer science, a high-level programming language is a programming language with strong abstraction from the details of the computer.

In contrast to low-level languages, it may use natural language elements, be easier to use, or may automate (or even hide entirely) significant

areas of computing systems (for example: memory management), making the process of developing a program simpler and more understandable

than when using a low-level language. The amount of abstraction provided defines how “high-level” a programming language is.

In the 1960s, a high-level programming language using a compiler was commonly called auto-code.

Examples of auto-codes are COBOL and Fortran.

Types of program languages


High-level languages are divided into the following categories:

➢ Procedural Languages
➢ Object-Oriented Languages
➢ Non- Procedural Languages

7
1. Procedural Languages
Procedural languages are also known third generation language or 3GL. In these languages, a program is a predefined set of instructions. Computer

executes these instructions in the same sequence in which these instructions are written. Each instruction in this language tells the computer what to

do and how to do. Some advantages and disadvantages of procedural languages are given below.

ADVANTAGES DISADVANTAGES

 Program statements are similar to English and are easy to learn.  The programs execute more slowly.

 Less time is required to write programs.  These languages use computer resources less efficiently.

 Programs are easier to understand and modify.  Data is exposed to whole program, so no security for data.

 Quality to extend itself.  Difficult to relate with real world objects.

 Needs only less memory.  Difficult to create new data types reduces extensibility.

8
• Popular Procedural Languages
Some of the most popular procedural languages are as follows:

1. FORTRAN
Fortran is a general-purpose, compiled and imperative programming language that is especially suited to numeric computation and scientific

computing. It was designed by John Backus and IBM in 1957; 65 years ago. FORTRAN stands for Formula Translation. It is mainly

used for engineering application and scientific use.

Code example

program average

! Read in some numbers and take the average


! As written, if there are no data points, an average of zero is returned
! While this may not be desired behavior, it keeps this example simple

implicit none

real, dimension(:), allocatable :: points


integer :: number_of_points
real :: average_points, positive_average, negative_average
average_points = 0.0
positive_average = 0.0
negative_average = 0.0

9
write (*,*) "Input number of points to average:"
read (*,*) number_of_points

allocate (points(number_of_points))

write (*,*) "Enter the points to average:"


read (*,*) points

! Take the average by summing points and dividing by number_of_points


if (number_of_points > 0) average_points = sum(points) / number_of_points

! Now form average over positive and negative points only


if (count(points > 0.) > 0) positive_average = sum(points, points > 0.) / count(points > 0.)
if (count(points < 0.) > 0) negative_average = sum(points, points < 0.) / count(points < 0.)

! Print result to terminal stdout unit 6


write (*,'(a,g12.4)') 'Average = ', average_points
write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
write (*,'(a,g12.4)') 'Average of negative points = ', negative_average
deallocate (points) ! free memory
end program average

ADVANTAGES DISADVANTAGES
• more natural; • missing “modern features” like pointers, novel data structures

• great flexibility • missing not-so-modern features like recursion!

• enhanced safety • encourages bad programming:

• parallel execution • heavy use of go-to-statement

• separate compilation • common blocks

• great portability

10
2. BASIC
BASIC stands for Beginner All Purpose Symbolic Instruction Code. It was created in 1963 by John G. Kemeny and Thomas E. Kurtz at

Dartmouth college. They wanted to enable students in non-scientific fields to use computer. It was mainly used by students to use the computer

for solving simple problems. It is easy to understand. It is widely used for education purpose.

Example code

ADVANTAGES DISADVANTAGES
• structure is very simple. • programs cannot be transferred to other operating systems.

• It’s not only a language but an “IDE”. • It cannot handle pointers directly.

• It provides a comprehensive interactive online help system.

11
3. COBOL
COBOL stands for Common business Oriented Language. It is specially designed for business application. It was developed in early 1960s.

The programs written in COBOL are lengthy but easy to read, write and maintain.

12
Example code

13
4. PASCAL
PASCAL is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage

good programming practices using structured programming and data structuring. This language is used for both scientific and business applications.

Its name was assigned in the honor of a French mathematician Blaise Pascal.

ADVANTAGES DISADVANTAGES

 mature system  no corporate support

 bindings for a lot of well-known libraries  issues in arrays

 unique extensions to common programming paradigms

14
Example code

15
5. C
C language is a popular high-level language. It was developed by Dennis Ritchie at AT&T Bell Laboratories in 1972. It was written as part

of UNIX operating system. It is also known as middle-level language because it provides the facilities to write application software as well

as system software.

Example code

16
Concept

17
18
2. Object-Oriented Languages
Object-oriented programming (OOP) is a technique in which programs are written on the basis of objects. An object is a collection of data and

functions. Object may represent a person, thing or a place in the real world. In OOP, data and all possible functions on data are grouped together.

Object oriented programs are easier to learn and modify. Python, C++ and Java are three popular object-oriented languages.

Example

A person can be an example of an object. It has some properties or characteristics that describe what it is. Some properties of Person object

can be as follows:

• Name
• Age
• Height

The person object also has some functions that describe what it can do. Some functions of Person object can be as follows:

• Walk
• Talk
• Eat

19
Features of OOP

20
1. PYTHON
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of

significant indentation. Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including

structured, object oriented and functional programming. It is often described as a “batteries included” language due to its comprehensive

standard library. Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and

first released it in 1991 as Python 0.9.0.

Example code

apple_stocks = [277.9, 280.9, 300,9]


print("Apple stocks on 11 dec")

print()

apple_stocks[0] = 300
print("Latest apple stocks:")
print(apple_stocks[0])
print()
print(apple_stocks)
apple_stocks[1] = 299.8
print("Lowest apple stocks today:")
print(apple_stocks[1])
print()

apple_stocks[2] = 312.9
print("Highest stocks of apple today:")
print(apple_stocks[2])
21
print("All stocks today")
print(apple_stocks)

22
2. Java
Java was developed at Sun Microsystem in 1995 by a team led by James Gosling. Sun Microsystems was purchased by Oracle in 2010.

Java is an OOP language based on the syntax of C++. It was originally designed in 1991 as Oak for use in embedded chips for electronic

Appliances like TV’s, toasters, ovens, washing machines etc.

Java can be used to write programs that can run on any platform. It is popular to write Web-based Internet

applications as the World Wide Web required the software to run across all the platforms. It is commonly used to develop applications for

servers, desktop computers and mobile devices.

23
Example code

24
3. C++
C++ is an OOP language. It was developed in 1980 at Bell Laboratories. It is an improved version of C language. It provides the facility of

working with objects and classes. It is very powerful language and is used to develop a variety of programs.

Some important features of C++ languages.

25
Example code

26
4. C#
C# (c-sharp) is OOP based on C++. It was developed by Anders Hejlsberg at Microsoft. C# has been accepted as a standard for Web

applications and XML-based Web services.

Some important features of C# language.

27
Example code

28
3. Non-Procedural-Languages
Non-procedural languages are also known as fourth generation languages or 4GL. In non-procedural languages, the user only needs to

tell the computer “What to do” not “How to do”. An important advantage of these languages is that they can be used by non-technical user

to perform a specific task. These languages accelerate programming process and reduce the coding errors. 4GL are normally used in

the database applications and report generation.

Some important features of non-procedural languages.

29
1. SQL
SQL stands for Structured Query Language. It is the most popular database query language. SQL was developed by IBM. It is a national

standard by American National Standards Institute (ANSI). SQL works with database programs like MS Access, DB2, Informix, MS SQL Server,

Oracle, Sybase etc.

Some important features of SQL language.

30
Example code

31
2. RPG
RPG stands for Report Program Generator. It was developed in early 1960s by IBM. It is used to generate business reports.

It is a non-procedural language. It is mostly used with IBM mid-range computers.

Example code

32
Difference between procedural and non-procedural

33
Advantages of High-level languages

34
Disadvantages of High-level languages

35
Advantages of low-level languages

36
Difference between low-level languages and high-level languages

37
38
39

You might also like