You are on page 1of 21

BHILAI INSTITUTE OF TECHNOLOGY,

RAIPUT (C.G.)
SRGI

Department of Computer Science & Engineering


B.Tech - 3rd sem

Name of Subject: Principle of Programming Language(PPL)

Paper No: 2

Lecture No.: Unit 02: L 1

Topic: Programming Language Processors

Name of Faculty: Dr. Ashish Kumar Tamrakar

Page| 1
Contents
SRGI

• LISP

Page| 2
Characteristic of Programming Language
SRGI

Characteristic of A Good Programming Language


• There are various factors, why the programmers prefer one language over the
another. And some of very good characteristics of a good programming
language are,
1) Clarity, Simplicity And Unity: A Programming language provides both a
conceptual framework for Algorithm planning and means of expressing them. It
should provide a clear, simple and unified set of concepts that can be used as
primitives in developing algorithms.
• It has minimum number of different concepts
•- with Rules for their combination being
•-simple and regular.
This attribute is called conceptual integrity.
2) Orthogonality: It is one of the most important feature of PL orthogonality is
the property that means " Changing A does not change B".
Page| 3
Characteristic of Programming Language
SRGI

• If I take Real world example of an orthogonal system Would be a radio, where


changing the station does not change the volume and vice versa.
• When the features of a language are orthogonal, language is easier to
learn and programs are easier to write because only few exceptions and
special cases to be remembered.
3) Support for Abstraction:- There is always found that a substantial gap
remaining between the abstract data structure and operations that characterize
the solution to a problem and their particular data structure and operations
built into a language.
4) Programming Environment: An appropriate programming environment adds
an extra utility and make language to be implemented easily like
The availability of- Reliable- Efficient - Well documentation.
• Speeding up creation and testing by-special Editors- testing packages
• Facility- Maintaining and Modifying- Multi Version of program software
product. Page| 4
Characteristic of Programming Language
SRGI

5) Ease of program verification:- Reusability:


• The reusability of program written in a language is always a central concern. A
program is checked by various testing technique like
• Formal verification method Desk checking Input output test checking. We
verify the program by many more techniques. A language that makes program
verification difficult maybe far more troublesome to use. Simplicity of semantic
and syntactic structure is a primary aspect that tends to simplify program
verification.
6) portability of programs: Programming language should be portable means it
should be easy to transfer a program from which they are developed to the
other computer.
• A program whose definition is independent of features of a Particular machine
forms can only support Portability. Example: Ada, FORTRAN, C, c++, Java.
7) Quick translation: It should admit quick translation.
8) Efficiency: It should permit the generation of efficient object code.
Page| 5
Factors that influences the evolution of
SRGI programming languages
• What are the different factors that influences the evolution of programming
languages?
• Readability
Software development was largely thought of in term of writing code “LOC”.
Language constructs were designed more from the point of view of the
computer than the users. Because ease of maintenance is determined in large
part by the readability of programs, readability became an important measure
of the quality of programs and programming languages. The result is a
crossover from focus on machine orientation to focus on human orientation.
The most important criterion “ease of use”.
• Writability
It is a measure of how easily a language can be used to create programs for a
chosen problem domain.
Most of the language characteristics that affect readability also affect
writability. Simplicity and orthogonality.
Page| 6
Factors that influences the evolution of
SRGI programming languages
• A smaller number of primitive constructs and a consistent set of rules for
combining them is much better than simply having a large number of
primitives.
Support for abstraction
Abstraction means the ability to define and then use complicated structures or
operations in ways that allow many of the details to be ignored.
A process abstraction is the use of a subprogram to implement a sort algorithm
that is required several times in a program instead of replicating it in all places
where it is needed.
• Expressivity: It means that a language has relatively convenient, rather than
cumbersome, ways of specifying computations.
Ex: ++count ⇔ count = count + 1 // more convenient and shorter
Reliability: A program is said to be reliable if it performs to its specifications
under all conditions.
Type checking: is simply testing for type errors in a given program, either by the
compiler or during program execution. Page| 7
Factors that influences the evolution of
SRGI programming languages
• The earlier errors are detected, the less expensive it is to make the required
repairs. Java requires type checking of nearly all variables and expressions at
compile time.
Exception handling: the ability to intercept run-time errors, take corrective
measures, and then continue is a great aid to reliability.
• Cost
Categories & Training programmers to use language
Writing programs “Writability” & Compiling programs
Executing programs
Language implementation system “Free compilers is the key, success of Java”
Reliability, does the software fail?
Maintaining programs: Maintenance costs can be as high as two to four times
as much as development costs.
Portability “standardization of the language”
Generality (the applicability to a wide range of applications)
Page| 8
Programming Methodology
SRGI

• When programs are developed to solve real-life problems like inventory


management, payroll processing, student admissions, examination result
processing, etc. they tend to be huge and complex. The approach to analyzing
such complex problems, planning for software development and controlling the
development process is called programming methodology.
• Types of Programming Methodologies
• There are many types of programming methodologies prevalent among
software developers
Procedural Programming
• Problem is broken down into procedures, or blocks of code that perform one
task each. All procedures taken together form the whole program. It is suitable
only for small programs that have low level of complexity.
• Example − For a calculator program that does addition, subtraction,
multiplication, division, square root and comparison, each of these operations
can be developed as separate procedures. In the main program each procedure
Page| 9
would be invoked on the basis of user’s choice.
Programming Methodology
SRGI

Object-oriented Programming
• Here the solution revolves around entities or objects that are part of problem.
The solution deals with how to store data related to the entities, how the
entities behave and how they interact with each other to give a cohesive
solution.
• Example − If we have to develop a payroll management system, we will have
entities like employees, salary structure, leave rules, etc. around which the
solution must be built.
Functional Programming
• Here the problem, or the desired solution, is broken down into functional units.
Each unit performs its own task and is self-sufficient. These units are then
stitched together to form the complete solution.
• Example − A payroll processing can have functional units like employee data
maintenance, basic salary calculation, gross salary calculation, leave processing,
loan repayment processing, etc.
Page| 10
Programming Methodology
SRGI

Logical Programming
• Here the problem is broken down into logical units rather than functional
units. Example: In a school management system, users have very defined roles
like class teacher, subject teacher, lab assistant, coordinator, academic in-
charge, etc. So the software can be divided into units depending on user roles.
Each user can have different interface, permissions, etc.
• Software developers may choose one or a combination of more than one of
these methodologies to develop a software. Note that in each of the
methodologies discussed, problem has to be broken down into smaller units. To
do this, developers use any of the following two approaches −
Top-down approach
Bottom-up approach
• Top-down or Modular Approach: The problem is broken down into smaller
units, which may be further broken down into even smaller units. Each unit is
called a module. Each module is a self-sufficient unit that has everything
Page| 11
necessary to perform its task.
Programming Methodology
SRGI

The following illustration shows an example of how you can follow modular
approach to create different modules while developing a payroll processing
program.

Page| 12
Programming Methodology
SRGI

Bottom-up Approach
• In bottom-up approach, system design starts with the lowest level of
components, which are then interconnected to get higher level components.
This process continues till a hierarchy of all system components is generated.
However, in real-life scenario it is very difficult to know all lowest level
components at the outset. So bottoms up approach is used only for very simple
problems.
• Let us look at the components of a calculator program.

Page| 13
Programming Methodology
SRGI

Bottom-up Approach

Page| 14
Structure and operations of translators
SRGI

Structure and operations of translators


• A translator may formally be defined as a function, whose domain is a source
language, and whose range is contained in an object or target language.
Source language ---------> Translator ---------> Target language
(instructions) (instructions)
• A little experience with translators will reveal that it is rarely considered part of
the translator's function to execute the algorithm expressed by the source,
merely to change its representation from one form to another. In fact, at least
three languages are involved in the development of translators: the source
language to be translated, the object or target language to be generated, and
the host language to be used for implementing the translator. If the translation
takes place in several stages, there may even be other, intermediate, languages.
Most of these - and, indeed, the host language and object languages
themselves - usually remain hidden from a user of the source language.

Page| 15
Structure and operations of translators
SRGI

T-diagrams
• A useful notation for describing a computer program, particularly a translator,
uses so-called T-diagrams, examples of which are shown in Figure 2.1.

Page| 16
Structure and operations of translators
SRGI

T-diagrams

Classes of translator
• It is common to distinguish between several well-established classes of
translator: The term assembler is usually associated with those translators that
map low-level language instructions into machine code which can then be
executed directly. Individual source language statements usually map one-for-
one to machine-level instructions. Page| 17
Structure and operations of translators
SRGI

• The term macro-assembler is also associated with those translators that map


low-level language instructions into machine code, and is a variation on the
above. Most source language statements map one- for-one into their target
language equivalents, but some macro statements map into a sequence of
machine- level instructions - effectively providing a text replacement facility,
and thereby extending the assembly language to suit the user. (This is not to be
confused with the use of procedures or other subprograms to "extend" high-
level languages, because the method of implementation is usually very
different.)
• The term compiler is usually associated with those translators that map high-
level language instructions into machine code which can then be executed
directly. Individual source language statements usually map into many
machine-level instructions.
• The term pre-processor is usually associated with those translators that map a
superset of a high-level language into the original high-level language, or that
perform simple text substitutions before translation takes place. Page| 18
Structure and operations of translators
SRGI

• The term high-level translator is often associated with those translators that


map one high-level language into another high-level language - usually one for
which sophisticated compilers already exist on a range of machines. Such
translators are particularly useful as components of a two-stage compiling
system, or in assisting with the bootstrapping techniques to be discussed
shortly.
• The terms decompiler and disassembler refer to translators which attempt to
take object code at a low level and regenerate source code at a higher level.
While this can be done quite successfully for the production of assembler level
code, it is much more difficult when one tries to recreate source code originally
written in, say, Pascal.
• Many translators generate code for their host machines. These are called self-
resident translators. Others, known as cross-translators, generate code for
machines other than the host machine. Cross-translators are often used in
connection with microcomputers, especially in embedded systems, which may
themselves be too small to allow self-resident translators to operate Page| 19
Structure and operations of translators
SRGI

• The term high-level translator is often associated with those translators that


map one high-level language into another high-level language - usually one for
which sophisticated compilers already exist on a range of machines. Such
translators are particularly useful as components of a two-stage compiling
system, or in assisting with the bootstrapping techniques to be discussed
shortly.
• The terms decompiler and disassembler refer to translators which attempt to
take object code at a low level and regenerate source code at a higher level.
While this can be done quite successfully for the production of assembler level
code, it is much more difficult when one tries to recreate source code originally
written in, say, Pascal.
• Many translators generate code for their host machines. These are called self-
resident translators. Others, known as cross-translators, generate code for
machines other than the host machine. Cross-translators are often used in
connection with microcomputers, especially in embedded systems, which may
themselves be too small to allow self-resident translators to operate Page| 20
SRGI

BIT-RAIPUR Page| 21

You might also like