You are on page 1of 17

Programming Languages

Low-level Languages
High-level Languages
Advantages & Disadvantages
Translators
Trends in Programming Languages
1
Introduction
u program
– a series of instructions make a computer
‘works’
– can be written in a variety of programming
languages
u programming lang. - later generations:
– fewer instructions
– provide a more sophisticated
programmer/computer interaction
2
Fourth
Fourth
4th generation
generation
gen. languages
languages
(4GLs)
(4GLs) High-level
languages
are
Procedural languages problem More
oriented sophistication
3rd Multipurpose
Multipurpose Business
Business Scientific
Scientific in programmer/
gen. BASIC
BASIC(1965)
(1965) COBOL
COBOL(1959)
(1959) FORTRAN
FORTRAN(1955)
(1955) computer
Pascal (1968)
Pascal (1968) interaction

2nd Low-level
Assembler
Assembler
gen. languages
are
1st Machine machine
Machine
gen. oriented

The hierarchy of programming languages 3


Low-level Languages
u Machine language
– a programming language that is interpreted &
executed directly by the computer

u Assembly language
– a symbolic language with an instruction set that
is basically one-to-one with the machine
language
4
Machine language (ML)
u each computer can only understand
programs that are written in its own ML
u is provided by the computer manufacturer
u translation is needed when executing
programs written in Pascal or BASIC
u written at the most basic level of computer
operation
– coded as a series of 0’s and 1’s, e.g., 10111010
5
Machine language (ML)

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
6
Assembly language

u also provided by the manufacturer


u one instruction for each computer operation
u instruction codes are represented by
mnemonics (a set of letters)
u the code must be assembled into machine
language for execution
assembly language
7
[refer to Fig 13.2]
Assembly language

u 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
u made programming much more convenient
u written using common names & words
more like human languages
u problem-oriented languages
– designed to solve specific problems
u e.g.,
FORTRAN, COBOL, BASIC, Pascal
& C language
9
[refer to Fig 13.4 - 13.8]
Advantages of
High-level Languages
u easier to write, to read & to modify
– written in English-like format
u programs - faster & shorter to code
– one statement for several computer operations
u more portable, i.e., can be executed by
different computers
– machine independent
10
Advantages of
Low-level Languages
u take up less storage space
u run faster
u useful for writing system programs
– e.g., operating systems (require fast & efficient
use of CPU)
u sometimes an operation can only be
performed in a low-level language
11
Translators
u programsmust be translated into machine
codes before execution

Source
Source Object
Object
Translator
Translator Execution
program
program program
program

A simplified translation process

12
Translators - 3 types
Source
Sourceprogram
program Translator
Translator Object
Objectprogram
program
assembly
assembly
language
language assembler
assembler
programs
programs machine
machine
codes
codes
compiler
compiler
high-level
high-level
language
language
programs
programs
interpreter
interpreter Execution
Execution

The functions of the three types of translators 13


Similarities between
compilers & interpreters
u both
translate high-level languages to
machine codes
u bothdirect errors in the programs & print
error messages
u bothwork out where to store the object
program & its data in the memory
14
Differences between
compilers & interpreters
Compilers Interpreters
Translation of the whole program one line at a time
source program before execution when it is run
Freqrency of each line is translated has to be translated
translation once every time it is
executed - slower
Object program can be saved for no object program is
future exeution generated, so, source
without the source program must be
program present for execution
15
Trends in
Programming Languages
u fewerinstructions
u more 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
16
Trends in
Programming Languages
u Logic programming (e.g., Prolog)
– 5th-generation computer language
– declarative language
– expert systems & artificial intelligence app.
u Object-oriented techniques
– e.g., Borland C++
u Visual development environments
– e.g., Microsoft Visual Basic
17

You might also like