programming languages low-level languages high-level languages advantages & disadvantages...
TRANSCRIPT
PROGRAMMING LANGUAGES
Low-level LanguagesHigh-level Languages
Advantages & DisadvantagesTranslators
Trends in Programming Languages
Computer Languages
Used 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)
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 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 0’s and 1’s, e.g.,
10111010
Machine Languages Understood and directly executed by CPU Instruction format :
The fields and their widths comprising the machine instruction
operation code operand/operand address
opcode operand
**Some formats may have two or more operand fields
Disadvantages of Machine 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)
very difficult to write, because: binary system - not ‘user friendly’ to huma
n it requires excellent memorizing power programmer has to keep track of storage loca
tions of data & instruction ASSEMBLY LANGUAGE
Disadv. Of Machine language (ML)
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
The hierarchy of programming languages
Fourth generationlanguages
(4GLs)
Fourth generationlanguages
(4GLs)
AssemblerAssembler
BusinessCOBOL (1959)
BusinessCOBOL (1959)
MachineMachine
MultipurposeBASIC (1965)Pascal (1968)
MultipurposeBASIC (1965)Pascal (1968)
ScientificFORTRAN (1955)
ScientificFORTRAN (1955)
Procedural languages
High-levellanguages
areproblemoriented
Low-levellanguages
aremachineoriented
4thgen.
3rdgen.
2ndgen.
1stgen.
More sophisticationin programmer/computerinteraction
Assembly language
also provided by the manufacturer one instruction for each computer operatio
n instruction codes are represented by mnemonics (symbolic instr. code)
the code must be assembled into machine language for execution
One-one correspondence with ML
Disadvantages: (similar to that of ML) machine dependent the program is usually long hard to learn & slow to write
HIGH LEVEL LANGUAGES
Assembly language
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++(object-oriented)
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 (with slight modifications) machine independent
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 (can access the hardware directly)
Adv. of Low-level Languages
Translators
Programs (except ML) must be translated into machine codes before execution
Sourceprogram
Sourceprogram TranslatorTranslator Object
program
Objectprogram
Execution
A simplified translation process
Translators - 3 types
Source programSource program TranslatorTranslator Object programObject program
ExecutionExecution
assemblylanguageprograms
assemblylanguageprograms
high-levellanguageprograms
high-levellanguageprograms
machinecodes
machinecodes
assemblerassembler
compilercompiler
interpreterinterpreter
The functions of the three types of translators
Compilers Interpreters
Translation of source program
the whole program before execution
one line at a time when it is run
Frequency of translation
each line is translated once
has to be translated every time it is executed - slower
Object program can be saved for future execution without the source program
no object program is generated, so, source program and interpreter must be present for execution
Compilers Interpreters
Translation of source program
the whole program before execution
one line at a time when it is run
Frequency of translation
each line is translated once
has to be translated every time it is executed - slower
Object program can be saved for future execution without the source program
no object program is generated, so, source program and interpreter must be present for execution
Differences betweencompilers &
interpreters
Trends in Programming
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
Logic programming (e.g., Prolog) 5th-generation computer language declarative language expert systems & artificial intelligence applicati
on Object-oriented techniques
e.g., Borland C++ Visual development environments
e.g., Microsoft Visual Basic
Trends in Programming
Languages