Sei sulla pagina 1di 28

3 GENERATION LANGUAGES AND OOPS

INTRODUCTION


Computer/programming languagelanguage that is acceptable to a computer system Programming/coding-process of writing instructions for an already planned program

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.

CLASSIFICATION OF COMPUTER LANGUAGES




MACHINE LANGUAGE ASSEMBLY LANGUAGE HIGH-LEVEL LANGUAGE


4th generation 5th generation

3rd generation

MACHINE LANGUAGE

Machine language

 

the language understood by the computer without using a translation program written as strings of binary 1s and 0s It has a two part format

Operation code
tells the computer what function to perform

Operand
tells the computer where to find or store the data

OPCODE (Operation code)

OPERAND (Address/location)

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.

Machine dependent- due to difference in internal design of every type of computer machine language differs from computer to computer. Difficult to program- it is difficult to program in machine language. Error prone - programmer has to remember opcodes and keep track of storage locations of data and instructions. Difficult to modify- checking machine instructions to locate errors is difficult and time consuming.

ASSEMBLY LANGUAGE

Introduced in 1952, helped in overcoming the limitations of machine language programming as:
Using alphanumeric mnemonic codes, instead of numeric 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.

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 (OBJECT PROGRAM)

(SOURCE ONE-TO ONE CORRESPONDENCE PROGRAM)

the input to the assembler is the assembly language program (source program), its output is the machine language program (object program)

Computer has to run the program, also assembler (program) to translate the original assembly language program into its equivalent machine language program. Mnemonic HLT CLA ADD SUB STA Opcode 00 10 14 15 30 Meaning 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

START START SET SET SET CLA ADD STA HLT

PROGRAM AT DATA AT ASIDE AN ASIDE AN ASIDE AN FRST SCND ANSR

0000 1000 ADDRESS ADDRESS ADDRESS

FOR FRST FOR SCND FOR ANSR

A sample assembly language program for

adding two no. & storing the result.

Easier to understand & use: due to the use of mnemonics 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 pseudoinstructions

Machine dependent: assembly language programs 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.

HIGH LEVEL LANGUAGES deal with high level coding, enabling the programmers to write instructions using familiar English words.

 Each statement of a high level language is normally a macro instruction translated into several machine language instructions. This is one to many translation.

E.g. consider the problem of adding two numbers FRST and SCND. If we use a high level language, only one instruction need be written: ANSR = FRST + SCND

There are three models of execution for modern high-level languages: Interpreted languages: are read and then
executed 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 an


executable form before running.

Translated languages : A language may be


translated into a low-level programming language for which native code compilers are already widely available.

Machine Independence
A program written in high-level language can be executed on many different types of computers.

Fewer errors
Working on high level languages allows the programmer to concentrate more on the logic of the program. Thus, leads to fewer errors.


Lower program preparation cost


Writing programs in high level requires less time and effort which ultimately leads to lower program preparation cost.

Better documentation
The 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 easier to locate, correct, insert, remove and modify instructions.
 Easier to learn and use High level languages are easier to learn, as they are very familiar to the natural languages used by us .

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.

Some examples of high level languages:

Some new high level programming languages are:

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 a visual environment, using graphical tools. E.g. Visual Basic (VB), VisualAge 5G high-level languages would use artificial intelligence to create software, making 5GLs extremely difficult to develop. Solve problems using constraints rather than algorithms, used in Artificial Intelligence

OBJECT ORIENTED PROGRAMMING LANGUAGE

Introduced in 1967 by the developers of a programming language named Simula67. Is a programming paradigm that uses "objects" data structures.  Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance. Java, J2EE, C++, C#, Visual Basic. NET, Python and JavaScript are popular OOP languages.

RITIKA DISHA BAJORIA

(9937) (9938)

Potrebbero piacerti anche