Programming Languages
Low-level Languages
High-level Languages
Advantages & Disadvantages
Translators
Trends in Programming Languages
Introduction
program
a series of instructions make a
computer works
can be written in a variety of
programming languages
programming
lang. - later generations:
fewer instructions
provide a more sophisticated
programmer/computer
interaction
4th
gen.
Fourth generation languages (4GLs)
Fourth
generation
languages
(4GLs)
Procedural languages
3rd
gen.
2nd
gen.
Multipurpose
Multipurpose
BASIC
(1965)
BASIC
(1965)
Pascal (1968)
Pascal (1968)
Business
Business
COBOL
(1959)
COBOL (1959)
Assembler
Assembler
1st
gen.
Machine
Machine
Scientific
Scientific (1955)
FORTRAN
FORTRAN (1955)
T
h
e
hi
er
a
rc
h
y
of
p
ro
g
r
a
mmi
ng
lang
uage
s
High-level languages are problem oriented
Low-level
languages
are
machine
oriented
More
sophistication
in programmer/
computer
interaction
Low-level Languages
Machine
language
a programming language that is interpreted
& executed directly by the computer
Assembly
language
a symbolic language with an instruction set
that is basically one-to-one with the machine 4
language
Machine language (ML)
each
computer can only understand
programs that are written in its own ML
is provided by the computer
manufacturer translation is needed when
executing
programs written in Pascal or BASIC
written at the most basic level of computer
operation
coded as a series of 0s and 1s, e.g., 10111010
Disadvantages:
very difficult to write, because:
binary system - not user friendly to human
it requires excellent memorising power
programmer has to keep track of
storage locations of data & instruction
ASSEMBLY LANGUAGE
Assembly language
also
provided by the manufacturer
one instruction for each computer operation
instruction
codes are represented by
mnemonics (a set of letters)
the code must be assembled into machine
language for execution
assembly language
Assembly language
[refer to Fig 13.2]
Disadvantages:
(similar to that of ML)
machine dependent
the program is usually long
hard to learn & slow to write
HIGH LEVEL LANGUAGES
8
High-level Languages
made
programming much more convenient
written using common names & words
more like human languages
problem-oriented languages
designed to solve specific problems
e.g.,
FORTRAN, COBOL, BASIC, Pascal
& C language
[refer to Fig 13.4 - 13.8]
Advantages of
High-level Languages
easier
to write, to read & to modify
written in English-like format
programs
- faster & shorter to code
one statement for several computer operations
more
portable, i.e., can be executed by
different computers
machine independent
10
Advantages of
Low-level Languages
take
up less storage space
run faster
useful
for writing system programs
e.g., operating systems (require fast & efficient
use of CPU)
sometimes
an operation can only be
performed in a low-level language
11
Translators
programs
must be translated into machine
codes before execution
Source
program Translator ObjectObject
program Execution
Source
Translator
program
program
A simplified translation process
12
Translators - 3 types
Source program
Translator
Translator
assembly
language
programs
assembler
assembler
compiler
compiler
Object program
Object program
machine
codes
Source program
interpreter
assembly language programs
interpreter
high-level
language
programs
machine codes
Execution
Translators - 3 types
The functions of the three types of translators
high-level language programs
Execution
13
Similarities between
compilers & interpreters
both
translate high-level languages to
machine codes
both
direct errors in the programs & print
error messages
both
work out where to store the object
program & its data in the memory
14
Differences between
compilers & interpreters
Translation of
source program
Freqrency of
translation
Compilers
Interpreters
the whole program
before execution
each line is translated
once
one line at a time
when it is run
has to be translated
every time it is
executed - slower
no object program is
generated, so, source
program must be
present for execution
Object program can be saved for
future exeution
without the source
program
15
Trends in
Programming Languages
fewer
instructions
more user-friendly
towards
using 4GLs
non-procedural language
users only have to state what needs doing,
but not how to do it
designed for users with minimal
programming knowledge & training
16
Logic
Prolog)
programming (e.g.,
5th-generation computer language
declarative language
expert systems & artificial intelligence app.
Object-oriented
techniques
e.g., Borland C++
Visual
development environments
e.g., Microsoft Visual Basic
17