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

09. Programming Languages-1

The document provides an overview of programming, detailing types of programs such as batch and event-driven programs, and explains the concept of programming languages. It distinguishes between high-level and low-level programming languages, as well as assembly languages, and discusses the roles of interpreters and compilers in translating code. Additionally, it highlights the advantages and disadvantages of using interpreters versus compilers in programming.

Uploaded by

imadsahar2005
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)
7 views

09. Programming Languages-1

The document provides an overview of programming, detailing types of programs such as batch and event-driven programs, and explains the concept of programming languages. It distinguishes between high-level and low-level programming languages, as well as assembly languages, and discusses the roles of interpreters and compilers in translating code. Additionally, it highlights the advantages and disadvantages of using interpreters versus compilers in programming.

Uploaded by

imadsahar2005
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/ 20

PROGRAMMING

LANGUAGES

_____________
Habib
Ullah
Programming?

• The process of telling the computer what to do

Also known as coding


Types of
Programs?
Batch Programs

Batch programming is a programming paradigm that can


execute certain commands automatically at the level
of an operating system such as DOS
These are typically started from a shell (or automatically via
a scheduler) and tend to follow a pattern of:

• Initialize internal data


• Read input data
• Process that data
• Print or store results
Event-Driven Programs

Examples? GUIs, microwave, camera

The system sends events to the program and the program responds to these as
they arrive.

Events can include things a user does - like clicking the mouse - or things that
the system itself does - like updating the clock.

These programs generally work as follows:


• Initialize the internal data
• Wait for events to arrive
• Identify an incoming event and react accordingly
Programmi
ng
Language?
Programming Language (PL)

• A vocabulary and set of grammatical


rules for instructing a computer to
perform specific tasks
OS
• Programmers use PLs to instruct the
computers to do things.
printf("hello, world\
n"); CPU

Memory
All programs consists of:

1. Sequence of instructions
2. Conditionals
3. Loops

These may contain:


• Data
• Input/output (print, etc)
• Operations (add, divide, etc)
Types of Programming Languages

• High level Programming Languages

printf("hello, world\ OS
n"); executabl
e CPU

compiler

Memory
• Low Level Programming Languages
High and Low Level Languages

High Level Language Machine Level Language


• It is programmer friendly • It is a machine friendly
language. language.
• High level language is less • Low level language is high
memory efficient. memory efficient.
• It is easy to understand. • It is tough to understand.
• It is used widely for • It is not commonly used
programming. now-a-days in programming.
Continued…

• The main difference between high level


language and low level language is that, Programmers
can easily understand or interpret or compile the high level
language compared to the machine. On the other hand,
Machine can easily understand the low level language
compared to human beings.

• Lying between machine languages & high-level languages


are languages called assembly languages
Assembly Languages

• Assembly languages are similar to machine languages,


but are easier to program in as they allow a programmer to
substitute names for numbers

Machine languages consist of numbers only


Translators

• Regardless of what language you use, you eventually need


to convert your program into a language that the computer
can understand

Two ways for doing that:


Compile the program or
Interpret the program
Interpreter and Compiler

•Interpreter is a program that executes


instructions written in a high-level language

An interpreter translates high-level instructions into an


intermediate form, which it then executes

In contrast, a compiler translates high-level instructions


directly into machine language
Continued…

• Compiled programs generally run faster than


interpreted programs

The advantage of an interpreter, however, is that it does not


need to go through the compilation stage during which the
whole of the high-level code is translated into machine
instructions in one go. This process can be time-consuming if the
program is long.

The interpreter can immediately execute high-level programs,


without waiting for the completion of the translation process
Interpreters:
Immediate response, but execute code
slowly

Compilers:
Takes longer to compile, but super-fast
execution
Similarities

• A Compiler and Interpreter both carry out the same


purpose
• Translates a high level language (like C++, Java) instructions into
the binary form which is understandable by computer hardware
(Machine language).
Compile Interprete
r r
Differences

• An interpreter
• Reads one statement then translates it and executes it and then takes
another.
• Easy to check for mistake(debug) than a compiler
• Programme instructions are performed slowly

• A Compiler
• Translates the entire program in one go and then executes it (.exe file).
• Hard to spot and correct mistakes
• Cannot make changes once executable programme is created.
• Programme instructions are performed quickly
Uses

• An interpreter is used for program development as it is


easier to debug and partially test the code.
• Once the program is error free and complete, the program
should then be compiled, as compiling only needs to be
done once.
ANY QUESTIONS?

You might also like