0% found this document useful (0 votes)
10 views

UNIT1 - 4types of Programming Languages

The document discusses types of programming languages and their uses. It covers several common programming languages like Java, C, C++, Python, PHP, Ruby, and Perl. It also discusses how computer programs are now used across many fields like business, healthcare, entertainment, defense, and communications. The document then covers the differences between low-level languages like Assembly that are closer to machine code, and high-level languages like Java and Python. It provides a hierarchy of languages from low-level machine code to high-level languages.

Uploaded by

meclinejosefl
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

UNIT1 - 4types of Programming Languages

The document discusses types of programming languages and their uses. It covers several common programming languages like Java, C, C++, Python, PHP, Ruby, and Perl. It also discusses how computer programs are now used across many fields like business, healthcare, entertainment, defense, and communications. The document then covers the differences between low-level languages like Assembly that are closer to machine code, and high-level languages like Java and Python. It provides a hierarchy of languages from low-level machine code to high-level languages.

Uploaded by

meclinejosefl
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Types of Programming Languages

D.Brindha,
Assistant Professor/CSE,
KITS.

1
Computer-programming language
🞂 As we have developed so many languages to communicate
among ourselves, computer scientists have developed
several computer-programming languages to provide
instructions to the computer (i.e., to write computer
programs).
🞂 Java
🞂 C
🞂 C++
🞂 Python
🞂 PHP
🞂 Ruby
🞂 Perl

2
Uses of Computer Programs

🞂 Today computer programs are being used in almost every field, household,
agriculture, medical, entertainment, defense, communication, etc.
🞂 MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are
examples of computer programs.
🞂 Computer programs are being used to develop graphics and special effects in
movie making.
🞂 Computer programs are being used to perform Ultrasounds, X-Rays, and other
medical examinations.
🞂 Computer programs are being used in our mobile phones for SMS, Chat, and
voice communication.

3
4
Which language computer can
understand?
🞂 Computers only understand machine code

🞂 A series of 1's and 0's fed and interpreted by the


computer
🞂 only way a computer can read English instructions

5
English to Binary

🞂 In order to talk to computer you must first


translate your English to Binary

🞂 It would be entirely unpractical to convert


every programming instruction you have
into binary by hand that is to machine code

🞂 That is why programming language comes


in
6
Middle-man
🞂 Programming language serve as a middle-man
🞂 Translate your instructions into machine code
◦ the series of 0's and 1's that the computer can understand
🞂 very useful for programmers

🞂 Programming language serve as interpreters for


converting languages into other languages
◦ Faster than converting by hand

🞂 They are able to convert your code into machine


code 0's and 1's
7
High Level Vs Low Level
🞂 Programming language is not English, and not
machine code, but somewhere in the middle

🞂 Low-level Programming languages


◦ Assembly
🞂 High-Level Programming languages
◦ Java or Python

🞂 Lower the level --> more similar to machine


code
8
A Hierarchy of Languages
High Level, Assembly and Machine
Language
❖ Machine language
✧ Native to a processor: executed directly by hardware
✧ Instructions consist of binary code: 1s and 0s
❖ Assembly language
✧ A programming language that uses symbolic names to represent
operations, registers and memory locations.
✧ Slightly higher-level language
✧ Readability of instructions is better than machine language
✧ One-to-one correspondence with machine language instructions
❖ Assemblers translate assembly to machine code
❖ Compilers translate high-level programs to machine code
✧ Either directly, or
✧ Indirectly via an assembler
Compiler and Assembler
Translating Languages
English: D is assigned the sum of A times B plus 10.

High-Level Language: D = A * B + 10

A statement in a high-level language is translated


typically into several machine-level instructions

Intel Assembly Language: Intel Machine Language:


mov eax, A A1 00404000
mul B F7 25 00404004
add eax, 10 83 C0 0A
mov D, eax A3 00404008
How do we write code?

🞂 Can't simply type word


into a text document
and expect that the
computer is able to
carry out a task
🞂 To properly send
instructions to the
computer we need
programming
languages

13
Basic elements of Computer
language
🞂 English has a predefined grammar, which needs to be followed to write
English statements in a correct way. Likewise, most of the Human
Interface Languages (Hindi, Tamil, English, Spanish, French, etc.) are
made of several elements like verbs, nouns, adjectives, adverbs,
propositions, and conjunctions, etc.

• Programming Environment • Loops


• Basic Syntax • Numbers
• Data Types • Characters
• Variables • Arrays
• Keywords • Strings
• Basic Operators • Functions
• Decision Making • File I/O

14
Structured Programming
C programming language is called a structured programming
language because to solve a large problem, it divides the
problem into smaller structural blocks each of which handles a
particular responsibility.
These structural blocks are
• Subroutines/procedures - functions
• Decision making blocks like if-else-elseif, switch-cases,
• Repetitive blocks like For-loop, While-loop, Do-while loop etc

The program which solves the entire problem is a collection of


such structural blocks. Even a bigger structural block like a
function can have smaller inner structural blocks like decisions
and loops. 15
Top-Down Design
A program is divided into a main module and its
related modules. Each module is in turn
divided into submodules until the resulting
modules are understood without further
division.

16
Subroutines/procedures
• A procedure is a subroutine that performs a specific
task.
• When the task is complete, the subroutine ends and
the main program continues from where it left off.
A Decision Statement

Syntax
if(condition)
false
condition
action

 if the condition is true


then execute the action. true
 action is either a single
statement or a group of action
statements within braces.
Decision Statement

• Syntax
if (condition) true false
Action_A condition

else
Action_B

• if the condition is true Action_A Action_B

execute Action_A
else
execute Action_B.
A Repetitive Statement (LOOP)
• Syntax
while (condition)
action
• How it works:
– if condition is true then execute condition
false

action
– repeat this process until
condition evaluates to false
true
• action is either a single
statement or a group of action
statements within braces.
Repetitive Statement
• Syntax
do action
while (condition)
• How it works: action
– execute action
– if condition is true then execute
action again
– repeat this process until
condition evaluates to false.
true
• action is either a single statement or condition
a group of statements within braces.
false
Advantages of Structured
Programming
1. It is user friendly and easy to understand.
2. Similar to English vocabulary of words and symbols.
3. They require less time to write.
4. They are easier to maintain.
5. These are mainly problem oriented rather than machine based.
6. Program written in a higher level language can be translated
into many machine languages and therefore can run on any
computer for which there exists an appropriate translator.
7. It is independent of machine on which it is used i.e. programs
developed in high level languages can be run on any computer.

22
Choosing a Programming Language
Before decide on what language to use,
consider the following:
• server platform
• the server software to run
• budget
• previous experience in programming
• the database chosen for backend

23

You might also like