You are on page 1of 27

At the end of the lesson, students should be

able to:
 Define programming language, programming
paradigm and language translators
Introduction
7.1 Definition

A set of words , abbreviation , symbols and codes


that enables a programmer to give instructions to a
computer
7.1 Definition

A Programmer writes programs using a programming


language
Programming
Language

Low-level Language High-level Language

Machine Assembly
language language
 The natural language of a computer
 Consists of strings of numbers (ultimately
reduced to 1's and 0's)
 Difficult to write
 Does not need to be translated
Advantages :
 ready for immediate execution
 Instructions are readily understood by the
computer

Disadvantages :
 instructions are extremely cryptic and difficult
to learn
 programs are lengthy
 machine-dependent
 Consists of English-like abbreviations
 Clearer to humans
 Need to be translated to machine language
before the computer processes it.
 Use mnemonics symbols.
Advantages :
 Instructions are easier to learn compared to
machine language

Disadvantages :
 programs are lengthy
 machine-dependent
WRITTEN IN A MACHINE WRITTEN IN A ASSEMBLY
LANGUAGE LANGUAGE

0100 add ax, dx


001101 100000 001101 110001 mov a1, b1
00101 10001 10000
mul b1, ax
01110
mov b1, 04h
 Instructions are written using a series of
English like words

 Easier to learn than machine or assembly


language

 Shorter program - a single instruction


corresponds to many operations at the
machine level
 Have to be converted to machine-language
before they can be executed

 Machine independent – can run on different


types of computers and operating system

 Instruction are coded


▪ The equation : wages = rate x hours
can be written in C++ as : wages = rate * hours;

 Examples :
FORTRAN (Scientific) , COBOL (Business),
BASIC , Pascal, Ada, C, C++, Java
The differences
Number High-Level Language Low-Level Language
1 Consists of English – like words to Consists of binary digits or
form instruction English – like abbreviations
to form instruction

2 Need translator to convert to Machine language no


low- level Language. need translatr.

3 Machine Independent Machine dependent

4 Easy to learn, modify and near to Difficult to learn, modify


human languages. and far to human
languages.
 is a general framework or model for designing
and organizing program
 A way in which computer/programming
language looks at the problem to be solved
Structured (Procedural)

 Programmer has to define precisely each step in


the performance of the task
Logic

 Let programmers make declarative statements


and then allow the machine to reason about the
consequences of those statements.
 This language doesn’t tell the computer how to do
something, but employing restrictions on what it
must consider doing.
Object - Oriented

 Use “object” to design programs.


 Ability to reuse and modify existing object.

Object is an item that can contain data and procedures


Programming
Paradigm

Logic
PROLOG
ASP
Datalog
 Any program that is not written in
machine language has to be translated
in machine language before it is
executed by the computer.
 Convert programming source code into
language that the computer processor
understands. (machine language)
Translator
Assembler Interpreter Compiler

translates a program translates one high- translates entire


written in assembly level program instructions written in
language into an instruction at a time a high-level language
equivalent program in into machine code into the equivalent
machine language. machine language.
Examples: Examples : Examples :
i. MASM BASIC, Pearl ,Python C++ , Java,
(Microsoft Macro Microsoft Visual Studio
Assembler)
ii.TASM
(Turbo Assembler)
iii.FASM
(Flat Assembler)
ADVANTAGES
Assembler Interpreter Compiler
• Very fast in translating • Easier to debug(check • Source code is not
assembly language to machine errors) than a compiler included, therefore
code as 1 to 1 relationship • Easier to create multi- compiled code is more
• Assembly code is often very platform code, as each secure than interpreted
efficient (and therefore fast) different platform would code
because it is a low level have an interpreter to run • Tends to produce faster
language the same code code than interpreting
• Assembly code is fairly easy to • Useful for prototyping source code
understand due to the use of software and testing basic • Produces an executable
English-like mnemonics program logic file, and therefore the
program can be run
without need of the
source code
DISADVANTAGES
Assembler Interpreter Compiler
• Assembly language is written for a • Source code is • Object code needs to be
certain instruction set and/or required for the produced before a final
processor program to be executable file, this can
• Assembly tends to be optimized for executed, and this be a slow process
the hardware it's designed for, source code can be • The source code must
meaning it is often incompatible with read making it be 100% correct for the
different hardware insecure executable file to be
• Lots of assembly code is needed to do • Interpreters are produced
relatively simple tasks, and complex generally slower
programs require lots of programming than compiled
time programs due to
the per-line
translation method

You might also like