Similar presentations:
Programming languages
1.
PROGRAMMINGLANGUAGES
Low-level Languages
High-level Languages
Advantages & Disadvantages
Translators
Trends in Programming Languages
2.
Computer LanguagesUsed to instruct the computers to work for us
Machine languages
Machine code (binary)
Assembly languages
Mnemonics (symbolic instruction code)
High-level Languages
Like human languages (pseudo code)
3.
Low-level LanguagesMachine 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
language
4.
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 0’s and 1’s, e.g., 10111010
5.
Machine LanguagesUnderstood and directly executed by CPU
Instruction format :
The fields and their widths comprising the machine
instruction
opcode
operation code
operand
operand/operand address
**Some formats may have two or more operand fields
6.
Disadvantages ofMachine Languages
Difficult to learn, understand and memorize
Programming is time consuming and easy to
make mistakes, difficult to debug
Machine dependent (cannot be used in
computers of other type)
Machine programs are very long
Machine oriented (not problem oriented)
7.
Disadv. Of Machine language (ML)very difficult to write, because:
binary system - not ‘user friendly’ to human
it requires excellent memorizing power
programmer has to keep track of storage
locations of data & instruction
ASSEMBLY LANGUAGE
8.
Programs & Progr. Lang.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
9.
The hierarchy ofprogramming languages
Fourth
generation
languages
(4GLs)
4th
gen.
High-level
languages
are
problem
oriented
Procedural languages
3rd
gen.
2nd
gen.
1st
gen.
Multipurpose
BASIC (1965)
Pascal (1968)
Business
COBOL (1959)
Assembler
Machine
Scientific
FORTRAN (1955)
Low-level
languages
are
machine
oriented
More
sophistication
in programmer/
computer
interaction
10.
Assembly languagealso provided by the manufacturer
one instruction for each computer operation
instruction codes are represented by
mnemonics (symbolic instr. code)
the code must be assembled into machine
language for execution
One-one correspondence with ML
11.
Assembly languageDisadvantages: (similar to that of ML)
machine dependent
the program is usually long
hard to learn & slow to write
HIGH LEVEL LANGUAGES
12.
High-level Languagesmade 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++(object-oriented)
13.
Advantages of High-level Languageseasier to write, to read & to modify
programs - faster & shorter to code
written in English-like format
one statement for several computer operations
more portable, i.e., can be executed by
different computers (with slight modifications)
machine independent
14.
Adv. of Low-level Languagestake 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 (can access the
hardware directly)
15.
TranslatorsPrograms (except ML) must be translated
into machine codes before execution
Source
program
Translator
A simplified translation process
Object
program
Execution
16.
Translators - 3 typesSource program
Translator
assembly
language
programs
assembler
Object program
machine
codes
compiler
high-level
language
programs
interpreter
Execution
The functions of the three types of translators
17.
Differences betweencompilers & interpreters
Translation of
source program
Frequency 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 and interpreter
must be present for
execution
Object program can be saved for
future execution
without the source
program
18.
Trends inProgramming Languages
fewer instructions (more high-level)
more user-friendly
towards using 4GLs
non-procedural language
users only have to state what needs to be
done, but not how to do it
designed for users with minimal programming
knowledge & training
19.
Trends inProgramming Languages
Logic programming (e.g., Prolog)
5th-generation computer language
declarative language
expert systems & artificial intelligence application
Object-oriented techniques
e.g., Borland C++
Visual development environments
e.g., Microsoft Visual Basic