Upload
dnlkaba
View
218
Download
0
Embed Size (px)
Citation preview
7/27/2019 14_prg_lang
1/17
1
Programming Languages
Low-level Languages
High-level LanguagesAdvantages & Disadvantages
TranslatorsTrends in Programming Languages
7/27/2019 14_prg_lang
2/17
2
Introductionuprogram
a series of instructions make a computer
works
can be written in a variety of programminglanguages
uprogramming lang. - later generations:
fewer instructions
provide a more sophisticated
programmer/computer interaction
7/27/2019 14_prg_lang
3/17
3
Fourthgeneration
languages
(4GLs)
Fourthgeneration
languages
(4GLs)
Assembler
Assembler
Business
COBOL (1959)
Business
COBOL (1959)
Machine
Machine
Multipurpose
BASIC (1965)Pascal (1968)
Multipurpose
BASIC (1965)Pascal (1968)
Scientific
FORTRAN (1955)
Scientific
FORTRAN (1955)
Procedural languages
High-level
languages
are
problem
oriented
Low-level
languagesare
machine
oriented
4th
gen.
3rd
gen.
2nd
gen.
1st
gen.
More
sophistication
in programmer/
computerinteraction
The hierarchy of programming languages
7/27/2019 14_prg_lang
4/17
4
Low-level Languages
u
Machine language a programming language that is interpreted &
executed directly by the computer
uAssembly language
a symbolic language with an instruction set thatis basically one-to-one with the machine
language
7/27/2019 14_prg_lang
5/17
5
Machine language (ML)
ueach computer can only understand
programs that are written in its own ML
u is provided by the computer manufacturer
u translation is needed when executingprograms written in Pascal or BASIC
uwritten at the most basic level of computeroperation
coded as a series of 0s and 1s, e.g., 10111010
7/27/2019 14_prg_lang
6/17
6
u
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
Machine language (ML)
7/27/2019 14_prg_lang
7/17
7
Assembly language
u
also provided by the manufactureruone instruction for each computer operation
u
instruction codes are represented bymnemonics (a set of letters)
u the code must be assembled into machine
language for execution
assembly language
[refer to Fig 13.2]
7/27/2019 14_prg_lang
8/17
8
u
Disadvantages: (similar to that of ML) machine dependent
the program is usually long
hard to learn & slow to write
HIGH LEVEL LANGUAGES
Assembly language
7/27/2019 14_prg_lang
9/17
9
High-level Languages
u
made programming much more convenientuwritten using common names & words
more like human languagesuproblem-oriented languages
designed to solve specific problems
ue.g., FORTRAN, COBOL, BASIC, Pascal
& C language
[refer to Fig 13.4 - 13.8]
7/27/2019 14_prg_lang
10/17
10
Advantages of
High-level Languages
u
easier to write, to read & to modify written in English-like format
uprograms - faster & shorter to code
one statement for several computer operations
umore portable, i.e., can be executed by
different computers
machine independent
7/27/2019 14_prg_lang
11/17
11
u
take up less storage spaceurun faster
u
useful for writing system programs e.g., operating systems (require fast & efficient
use of CPU)
usometimes an operation can only be
performed in a low-level language
Advantages of
Low-level Languages
7/27/2019 14_prg_lang
12/17
12
Translators
u
programs must be translated into machinecodes before execution
Source
program
Source
program TranslatorTranslator Object
program
Object
programExecution
A simplified translation process
7/27/2019 14_prg_lang
13/17
13
Translators - 3 typesSource programSource program TranslatorTranslator Object programObject program
ExecutionExecution
assembly
language
programs
assemblylanguage
programs
high-level
language
programs
high-level
language
programs
machine
codes
machine
codes
assemblerassembler
compilercompiler
interpreterinterpreter
The functions of the three types of translators
7/27/2019 14_prg_lang
14/17
14
Similarities between
compilers & interpreters
uboth translate high-level languages tomachine codes
uboth direct errors in the programs & printerror messages
uboth work out where to store the object
program & its data in the memory
7/27/2019 14_prg_lang
15/17
15
Compilers Interpreters
Translation of
source program
the whole program
before execution
one line at a time
when it is run
Freqrency of
translation
each line is translated
once
has to be translated
every time it is
executed - slower
Object program can be saved for
future exeutionwithout the source
program
no object program is
generated, so, sourceprogram must be
present for execution
Differences between
compilers & interpreters
7/27/2019 14_prg_lang
16/17
16
Trends in
Programming Languages
u
fewer instructionsumore user-friendly
u
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
7/27/2019 14_prg_lang
17/17
17
uLogic programming (e.g., Prolog)
5th-generation computer language
declarative language
expert systems & artificial intelligence app.uObject-oriented techniques
e.g., Borland C++
uVisual development environments
e.g., Microsoft Visual Basic
Trends in
Programming Languages