Upload
yogesh-kumar
View
225
Download
0
Embed Size (px)
Citation preview
8/6/2019 3 Generation Languages n Oops
1/28
3 GENERATION
LANGUAGES
AND OOPS
8/6/2019 3 Generation Languages n Oops
2/28
8/6/2019 3 Generation Languages n Oops
3/28
Analogy with natural
languages Computer languages use a limited vocabulary
Computer problems need to be solved by breaking
down into discrete logical steps comprising 4
fundamental operations
input and output operations
arithmetic operations
Movement of operation within CPU & memory
Logical or comparison operations
Syntax rules of language to be followed
smaller and simpler than natural languages but have to
be used with great precision.
8/6/2019 3 Generation Languages n Oops
4/28
CLASSIFICATION OF COMPUTER
LANGUAGES
MACHINE LANGUAGE
ASSEMBLY LANGUAGE
HIGH-LEVEL LANGUAGE
3rd generation 4th generation 5th generation
8/6/2019 3 Generation Languages n Oops
5/28
MACHINE
LANGUAGE
8/6/2019 3 Generation Languages n Oops
6/28
Machine language
the language understood by the computerwithout using a translation program
written as strings of binary 1s and 0s
It has a two part format
Operation code Operand tells the computer what tells the computer where
function to perform to find or store the data
OPCODE
(Operation code)
OPERAND
(Address/location)
8/6/2019 3 Generation Languages n Oops
7/28
Programs written in machine
language can be executed very
fast by the computer. This is
because machine instructions
are directly understood by the
computer, and no translation
of the program is required.
8/6/2019 3 Generation Languages n Oops
8/28
Machine dependent- due to difference in internaldesign of every type of computer machine languagediffers from computer to computer.
Difficult to program- it is difficult to program inmachine language.
Error prone - programmer has to remember opcodesand keep track of storage locations of data andinstructions.
Difficult to modify- checking machine instructions tolocate errors is difficult and time consuming.
8/6/2019 3 Generation Languages n Oops
9/28
ASSEMBLY
LANGUAGE
8/6/2019 3 Generation Languages n Oops
10/28
Introduced in 1952, helped in overcoming the limitations
of machine language programming as:
Using alphanumeric mnemonic codes, instead ofnumeric codes. e.g. using ADD instead of 1110 (binary) or
14 (decimal), using SUB instead of 1111 (binary) or 15
(decimal)
Allowing storage locations to be represented in the
form of alphanumeric addresses, instead of numeric.e.g. the memory locations 1000 & 1001 may be
represented as FRST & SCND
By providing additional instructions, called pseudo
instructions, in the instruction set.
8/6/2019 3 Generation Languages n Oops
11/28
Assembler :
Translator program, which is known as an
assembler translates an assembly language
program into an equivalent machine language
program of the computer.
ASSEMBLY
LANGUAGE
PROGRAM
INPUT ASSEMBLER OUTPUT MACHINE
LANGUAGE
PROGRAM
(SOURCEPROGRAM)
ONE-TO ONE CORRESPONDENCE (OBJECTPROGRAM)
the input to the assembler is the assembly
language program (source program), its output is
the machine language program (object program)
8/6/2019 3 Generation Languages n Oops
12/28
Computer has to run the program, also assembler
(program) to translate the original assembly
language program into its equivalent machine
language program.
Mnemonic Opcode Meaning
HLT
CLA
ADD
SUBSTA
00
10
14
1530
Halt, used at the end of program
to stop
Clear &add into A register
Add to the contents of A register
Subtract from the contents of A
register
Store A register
8/6/2019 3 Generation Languages n Oops
13/28
START PROGRAM AT 0000
START DATA AT 1000
SET ASIDE AN ADDRESS FOR FRST
SET ASIDE AN ADDRESS FOR SCND
SET ASIDE AN ADDRESS FOR ANSR
CLA FRSTADD SCND
STA ANSR
HLT
A sample assembly language program for
adding two no. & storing the result.
8/6/2019 3 Generation Languages n Oops
14/28
Easier to understand & use: due to the use ofmnemonics and symbolic names
Easier to locate & correct errors: programmers need
not keep track of storage locations, fewer errors are
made. Easier to modify: easier to understand, locate,
correct, and modify instructions.
No worry about addresses: need not keep track of
storage locations of the data and instructions
Easily relocatable: due to the availability of pseudo-
instructions
8/6/2019 3 Generation Languages n Oops
15/28
Machine dependent: assembly languageprograms differ from computer to computer.
Knowledge of hardware required: assembly
languages are machine dependent, so the
programmer must have good knowledge of the
characteristics and logical structure of his
computer.
Machine level coding: Writing assembly
language programs is still time consuming and
not very easy.
8/6/2019 3 Generation Languages n Oops
16/28
8/6/2019 3 Generation Languages n Oops
17/28
HIGH LEVEL LANGUAGES deal with
high level coding, enabling theprogrammers to write instructions
using familiar English words.
Each statement of a high levellanguage is normally a macro
instruction translated into several
machine language instructions. Thisis one to many translation.
8/6/2019 3 Generation Languages n Oops
18/28
E.g.
consider the problem of
adding two numbers
FRST and SCND. If weuse a high level language,
only one instruction need
be written:ANSR = FRST + SCND
8/6/2019 3 Generation Languages n Oops
19/28
There are three models of execution for
modern high-level languages:
Interpreted languages: are read and thenexecuted directly, with no compilation stage. A
program called an interpreter reads the program
line by line and executes the lines as they are read.
Compiled languages: are transformed into anexecutable form before running.
Translated languages : A language may betranslated into a low-level programming language
for which native code compilers are already widely
available.
8/6/2019 3 Generation Languages n Oops
20/28
Machine IndependenceA program written in high-level language can be
executed on many different types of computers.
Fewer errorsWorking on high level languages allows theprogrammer to concentrate more on the logic of the
program. Thus, leads to fewer errors.
Lower program preparation costWriting programs in high level requires less time and
effort which ultimately leads to lower program
preparation cost.
8/6/2019 3 Generation Languages n Oops
21/28
Better documentationThe statements of a program written in high level can
be easily understood by a programmer familiar with
the problem domain.
Easier to maintain
Because they are easier to understand, hence it is easierto locate, correct, insert, remove and modify
instructions.
Easier to learn and useHigh level languages are easier to learn, as they arevery familiar to the natural languages used by us .
8/6/2019 3 Generation Languages n Oops
22/28
Lower efficiency
Program written in high level languages take more time
to execute, and require more main memory space.
Less flexibility
High level languages are less flexible than assembly
languages, because they do not normally have
instructions or mechanism to control the computers
CPU, memory and registers.
8/6/2019 3 Generation Languages n Oops
23/28
Some examples of high level
languages:
8/6/2019 3 Generation Languages n Oops
24/28
8/6/2019 3 Generation Languages n Oops
25/28
Third-generation languages (3GLs) are the first to
use true English-like phrasing, making them easier
to use than previous languages. E.g.: FORTRAN,COBOL, c++
4GLs may use a text-based environment (like a
3GL) or may allow the programmer to work in avisual environment, using graphical tools. E.g.
Visual Basic (VB), VisualAge
5G high-level languageswould use artificial
intelligence to create software, making 5GLsextremely difficult to develop. Solve problems using
constraints rather than algorithms, used in
Artificial Intelligence
8/6/2019 3 Generation Languages n Oops
26/28
OBJECT
ORIENTED
PROGRAMMING
LANGUAGE
8/6/2019 3 Generation Languages n Oops
27/28
Introduced in 1967 by the developers ofa programming language named Simula-
67.
Is a programming paradigmthat uses"objects" data structures.
Programming techniques may includefeatures such as data abstraction,encapsulation, modularity,polymorphism, and inheritance.
Java, J2EE, C++, C#, Visual Basic. NET,
Python and JavaScript are popular OOP
languages.
8/6/2019 3 Generation Languages n Oops
28/28
RITIKA (9937)
DISHA BAJORIA (9938)