Evoluation of Programming Languages DR Jivtode
Evoluation of Programming Languages DR Jivtode
Evoluation of Programming Languages DR Jivtode
A Programming language is the language through which user can communicate with the computer by
writing program instructions.
Every computer programming language contains a set of predefined words and a set of rules (syntax)
that are used to create instructions of a program.
The Computer programming languages are classified as –
1) Low Level Language
2) Middle Level Language
3) High Level Language
1) Low Level Language
Low level language is also known as Machine Language. Machine language is also known as
Machine code. Binary language is an example of low level language. The binary language
contains only two symbols 1 and 0. All the instructions of binary language are written in the form
of binary numbers 1’s and 0’s. A computer can directly understand the binary language. Low
Level language is as the First generation language.
Advantages
A computer can easily understand the low level language.
Low level language instructions are executed directly without any translation.
Low level language instructions require very less time for their execution.
Disadvantages
Low level language instructions are very difficult to use and understand.
Low level language instructions are machine dependent, that means a program written for a
particular machine does not executes on other machine.
In low level language, there is very difficult to find errors, debug and modify.
2) Middle Level Language
Middle level language is also known as Assembly language or Symbolic language. Assembly
language is an example of Middle level language. In Assembly language, the instructions are
created using symbols such as letters, digits and special characters. In assembly language, we use
predefined words called mnemonics. A program written is an assembly language using
mnemonics called assembly language program or symbolic program.
The process of translating an assembly language program into its equivalent machine language
program with the use of an assembler. Assembler is used to translate middle level language to
low level language.
2) Interpreters
Interpreter is a translator which is used to convert programs in high level language to low level
language. Interpreter translates line by line statements and reports the error once it encountered
during the translation process. It gives better error diagnostics than a compiler.
3) Assemblers
Assembler is a translator which is used to translate the assembly language code into machine
language code.
Compilation Process
The compilation process is a sequence of various phases such as Lexical analyzer, Syntax analyzer,
Semantic analyzer, Intermediate code generator, Machine independent code optimizer, Code
generator, Machine dependent code optimizer. Each phase takes input from its previous stage, has its
own representation of source program, and feeds its output to the next phase of the compiler.
The different phases of compilation process are as
1) Lexical analysis
2) Syntax analysis
3) Semantic analysis
4) Intermediate code generation
5) Code optimization
6) Code generation
In Error handling, each phase can encounter errors. After detecting an error, a phase must handle
the error so that compilation can proceed. In lexical analysis, errors occur in separation of tokens. In
syntax analysis, errors occur during construction of syntax tree. In semantic analysis, errors occurs
during type conversion, In code optimization, errors occur when the result is affected by the
optimization. In code optimization, errors occur when the code is missing.
7) Documentation
Documentation is one of the most important components of an application development. A well-
documented application is also useful for other programmers because even in the absence of the
author, they can understand it.
QUESTIONS
User requirements
Problem analysis
Designing algorithm
Program coding
Fig shows 1.1 Process of program development
1.2 Design Methods
Designing is the first step for obtaining solution of a given problem.
The purpose of designing is to represent the solution for the system.
There are three types of Design Methods
1.2.1 Top-down design
1.2.2 Bottom-up design
1.2.3 Modular approach
1.2.1 Top-down Design
Top-Down method starts from top-level component to lowest level (bottom)
component. In this design method , the system is divided into major components.
Then each major component is divided into lower level components.
1.2.2 Bottom-Up Design
Bottom-Up design method is the reverse of Top-Down approach. It starts from
the lowest level component to the highest-level component. It first designs the
basic components and from these basic components the higher-level component
are designed.
1.1.3 Modular Approach
In a programming , module is logically a well-defined part of program. Each
module is a separate part of the program. It is easy to modify a program written
with modular approach because changes in one module don’t affect other
modules of program. It is also easy to check bugs in the program in module level
programming.
1.3 Program development Life Cycle
A program consists of a sequence of operations. It contains only those operations
, which the computer can perform. Problem solving can be defined as “ The task
of expressing the solution of complex problems in terms of simple operations
understood by the computer”.
In order to solve a problem using a computer following stages as given below –
1. Problem definition
2. Problem analysis
3. Design a solution using design tools such as flowcharts and algorithms
4. Programming the computer ( Coding )
5. Checking and Correcting errors ( Testing and Debugging )
6. The documentation of the program
7. Program enhancement or maintenance
1. Problem definition
Problem definition requires to develop exact specification of the problem. In
other words to extract from the problem statement a set of precisely defined
tasks. The problem definition should be in the users language such as English or
some other natural language. It may include charts , tables and equations of
different kinds. The exact notation used to depends on the problem area.
2. Problem analysis
In this part of problem solving to understand the requirements of the problem to
be solved. This process is the first step towards the solution domain. Explicit
requirements about the input – output , time constraints , processing
requirements, accuracy , memory limitations , error handling and interfaces are
understood at this stage. The end result of this analysis is the selection of a
method , which is to be used on the computer or a decision that a computer
should not be used because of constraints as it may be seen that manual methods
are better.
3. Design of Problem Solutions and Use of Design tools
The process of problem definition and problem analysis is complete to define the
solution to the problem. The solution should include a sequence of well-defined
steps that will input and manipulate the data and produce the desired output.
The process of good designing can be done efficiently with the choice of certain
design tools. Algorithm and Flowcharts are two design tools ,which help in the
representation of a solution to a problem.
4. Coding
The problem has been analyzed it must be coded in a language which the
computer can understand. This code is called a Program. Coding is the translation
of algorithm into a suitable computer language such as C , Pascal , COBOL,
FORTRAN etc.
5. Testing and Debugging
The program is created it must be complied and executed. During the
complication process , errors are detected by the compiler. These errors are
similar to grammatical errors in English and are known as syntax errors. When to
informed by the compiler that such an error has occurred. They must determine
what correction should be made to the source program, make the correction and
then recompile. If the program compile correctly , then can processed with the
execution of the resulting object program , which is in machine-readable form.
6. Documentation and Maintenance
Documentation is the process of writing explanation about the program in the
form of comments and remarks. Documentation may be divided into two
categories , namely technical documentation and user-level documentation. The
technical documentation is meant for the programmer who may try to modify
the program and it includes information about the formula used , data and
programs imported from other programs, developed by different programmers.
The user-level documentation helps the users, who may not be programmers , to
understand the program and to make use of the program.
Program maintenance means periodic review of the programs to ensure that it
meets the revised needs of the organization. Many a times to enhance the clarity
of the programs fresh documentation may be needed. Changes in program may
also be needed due to availability of new and more sophisticated equipment. A lot
of time and money can be saved if attention is paid to maintenance of the
programs which is a continuing task.
1.4 Development tools
There are two basic development tools , which help in the representation of a
solution to a problem.
1.4.1 Algorithm
1.4.2 Flowcharts
Psedocode
1.4.1 Algorithm
1.4.1.1 Definition
Algorithm refers to the logic of a program. It is a step-by-step procedure to solve
a given problem.
1.4.1.2 Characteristics of Algorithm
1. Each instruction should be precise and unambiguous ( Confusion )
2. Each instruction should be executed in a finite time.
3. One or more instructions should not be repeated infinitely.
4. Simple statement and Structures should be used in the development of the
algorithm
5. After executing the instructions , the desired results are obtained.
1.4.1.3 Advantages of algorithm
1. It is plain English language
2. It is step-by-step representation of a solution to a given problem
3. It is easy to understand the logic
4. It is first develop an algorithm, and then convert it into a flowchart and then
into a computer program
5. It is independent of any programming language
6. It is every easy to create program
7. It is easy to debug as every step has got its own logical sequence
1.4.1.4 Disadvantages of algorithm
1. It is very time consuming
2. If not make appropriate changes in the process and repeat the process.
4. Flow Line: The flow lines with arrow heads are used to indicate the flow of
operation, where the exact sequences of instruction are to be executed. The
normal flow of flow chart from top to bottom and left to right.
5. Decision Box: This symbol is used in a flow chart to indicate a point at which
a decision has to be made.
6. Connectors: This symbol are do not represent any operation and their used
only the sake of convenience and clarity.
Process1
Process1
Process2
2. Selection Logic: Selection logic is also known as decision logic, it is used for
making decision, selection logic, selecting proper path out of two or more
alternative path in a program logic selection logic used either IF---THEN---ELSE
condition structure.
The IF---THEN---ELSE structure says that if the condition is true then do process1
and if it is not then skip over from process. The E?NDIF is used to indicate the end
of the decision structure.
If condition=true then
Con Process1
ditio Else
n?
Process2
No End if
Process2
Yes
Process1
3. Iteration Logic: Iteration logic is used to produce loop when one or more
instruction may be executed several times depending on same condition. This
logic uses two structure
a. Do-----While
b. Repeat------Until
The Do---While is used for looping. The looping continuous as long as the
condition is not true. In Do----While structure that will change the condition that
controls the loop. The condition is tested of the top of the loops. The ENDDO
marks the end of the Do----While loop.
Flow Chart Pseudo code
Yes
ENDDO
Process1
Process2
Repeat……Until:
The Repeat….Until is used for looping. The looping until the condition becomes
true. That is, the execution of the statement with in the loop is repeated as long as
the condition is not true. The condition is tested of the bottom of the loop. Until
followed by some condition marks the end of the Repeat….Until structure.
Process1
Repeat
Process1
Yes
Process2 Process2
Until condition
Con
ditio
n?
No
In the above fig the input to an interpreter is the source program. No object
program is saved for future use, repeated interpretation of a program is
necessary for its repeated execution. An interpreter translate and executes a high
level language program statement by statement a program , a program statement
must be reinterpreted every time it is encountered during program execution .
Interpreter are easier to write because they are less complex program then
compliers. They also require less memory space for execution then compilers.
1.7.3 Assembler
Assembler is a software which translate a program written in assembly language
in to its equivalent in machine language. The program written in assembly
language deals with a low level language. An assembler translate the complete
source program into an object program, identifying any errors. There are any
errors the assembler will list or display these errors as well as the complete
source and object programs.
1.8 Differentiate between Interpreter and Compiler
Interpreter Compiler
1. It executes one instruction at a 1. It executes the complete
time. instructions or set of instructions
at a time.
2. It is a program that translates 2. It is a program that translates
the English like statements f a the English like statements of a
HLL into the MLL of a computer. HLL into the MLL of a computer.
3. It is easy to debug. 3. It is difficult to debug as
compared with interpreter.
4. it is slower . 4. It is faster.
5. It used for languages such as 5. It is use for languages such as
BASIC. FORTRAN , PASCAL , COBOL etc
6. Transaction & execution is 6. Transaction and execution are
simultaneous. done at two different instances.
7. No object file is generated. 7. Object file is created.
8. Locating an error is instant. 8. Locating an error is not instant.
9. BASIC is an example of 9. TURBOC , PASCAL is an example
Interpreter. of Compiler.
1.9.4 Design a flowchart and an algorithm to find the sum of three numbers.
Algorithm
Step 1 Start
Step 2 Input A,B,C
Step 3 [Compute] Sum A+B+C
Step 4 Output Sum
Step 5 Stop
Flowchart
1.9.5 Design a flowchart and an algorithm to find the area of a square.
Algorithm
Step 1 Start
Step 2 Input the value for a [ side ]
Step 3 [Compute] Area a*a
Step 4 Output Area
Step 5 Stop
Flowchart
Flowchart
1.9.8 Develop a flowchart and an algorithm to reverse a given number
[ example N=12345 Reversed number=54321].
Algorithm
Step 1 Start
Step 2 Input NUM
Step 3 [ Initialize ] REV 0
Step 4 Repeat Step 5 While NUM <>0
Step 5 [ Compute ]
a. [ Remainder ] R MOD[ NUM,10]
b. [ Quotient ] NUM INT [ NUM / 10 ]
c. REV REV * 10 + R
Step 6 Output Rev
Step 7 Stop
Flowchart