0% found this document useful (1 vote)
680 views

PPL (Unit I)

The document provides an introduction to principles of programming languages. It discusses reasons for studying programming language concepts such as increased ability to express ideas, improved background for choosing appropriate languages, and increased ability to learn new languages. It also covers programming domains, language evaluation criteria including readability and writability, and characteristics that influence readability such as simplicity, orthogonality, and control statements.

Uploaded by

THAISIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
680 views

PPL (Unit I)

The document provides an introduction to principles of programming languages. It discusses reasons for studying programming language concepts such as increased ability to express ideas, improved background for choosing appropriate languages, and increased ability to learn new languages. It also covers programming domains, language evaluation criteria including readability and writability, and characteristics that influence readability such as simplicity, orthogonality, and control statements.

Uploaded by

THAISIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

PRINCIPLES OF

PROGRAMMING
LANGUAGES

Presented By
Syed. Thaisin Asst.Professor
CSE-DEPT
VCET
UNIT-I
B.TECH IV CSE- I SEM
SYLLABUS
PRELIMINARY CONCEPTS: REASONS FOR
STUDYING CONCEPTS OF PROGRAMMING
LANGUAGES, PROGRAMMING DOMAINS,
LANGUAGE EVALUATION CRITERIA, INFLUENCES
ON LANGUAGE DESIGN, LANGUAGE CATEGORIES,
LANGUAGE DESIGN TRADE-OFFS,
IMPLEMENTATION METHODS, PROGRAMMING
ENVIRONMENTS, EVOLUTION OF MAJOR
PROGRAMMING LANGUAGES.
SYNTAX AND SEMANTICS: GENERAL PROBLEM OF
DESCRIBING SYNTAX, FORMAL METHODS OF
DESCRIBING SYNTAX, ATTRIBUTE GRAMMARS,
DESCRIBING THE MEANINGS OF PROGRAMS
 INTRODUCTION TO PRINCIPLES OF
PROGRAMMING LANGUAGE
 ARE YOU AIMING TO BECOME A SOFTWARE ENGINEER ONE DAY?

DO YOU ALSO WANT TO DEVELOP A MOBILE APPLICATION THAT


PEOPLE ALL OVER THE WORLD WOULD LOVE TO USE?

ARE YOU PASSIONATE ENOUGH TO TAKE THE BIG STEP TO ENTER


THE WORLD OF PROGRAMMING?

THEN YOU ARE IN THE RIGHT PLACE BECAUSE THROUGH THIS


ARTICLE YOU WILL GET A BRIEF INTRODUCTION TO
PROGRAMMING. NOW BEFORE WE UNDERSTAND WHAT
PROGRAMMING IS, YOU MUST KNOW WHAT IS A COMPUTER.

A COMPUTER IS A DEVICE THAT CAN ACCEPT HUMAN


INSTRUCTION, PROCESSES IT AND RESPONDS TO IT OR A
COMPUTER IS A COMPUTATIONAL DEVICE WHICH IS USED TO
PROCESS THE DATA UNDER THE CONTROL OF A COMPUTER
PROGRAM. PROGRAM IS A SEQUENCE OF INSTRUCTION ALONG
WITH DATA.
Characteristics of a programming Language –
A programming language must be simple, easy to learn and use, have
good readability and human recognizable.
Abstraction is a must-have Characteristics for a programming language
in which ability to define the complex structure and then its degree of
usability comes.
A portable programming language is always preferred.
Programming language’s efficiency must be high so that it can be easily
converted into a machine code and executed consumes little space in
memory.
A programming language should be well structured and documented so
that it is suitable for application development.
Necessary tools for development, debugging, testing, maintenance of a
program must be provided by a programming language.
A programming language should provide single environment known as
Integrated Development Environment(IDE).
A programming language must be consistent in terms of syntax and
semantics.
REASONS FOR STUDYING CONCEPTS
OF PROGRAMMING LANGUAGES
 Increased capacity to express ideas:

 People can easily express their ideas clearly in


any language only when they have clear
understanding of the natural language.
 Similarly, if programmers want to simulate the
features of languages in another language, they
should have some ideas regarding the concepts in
other languages as well.
 Improved background for choosing
appropriate languages
 Many programmers when given a choice of
languages for a new project, continue to use the
language with which they are most familiar, even if
it is poorly suited to the project.
 If these programmers were familiar with a wider
range of languages, they would be better able to
choose the language that includes the features that
best address the characteristics of the problem at
hand.
 Increased ability to learn new
languages
 Insoftware development, continuous learning is
essential.
 Theprocess of learning a new programming language
can be lengthy and difficult, especially for someone
who is comfortable with only two or more languages.
 Once a thorough understanding of the fundamental
concepts of languages is acquired, it becomes far easier
to see how these concepts are incorporated into the
design of the language being learned.
 Better understanding the
significance of implementation
 An understanding of implementation issues leads to
an understanding of why languages are designed the
way they are.
 Thisknowledge in turn leads to the ability to use a
language more intelligently, as it was designed to use.
 We can become better programmers by understanding
the choices among programming language constructs
and consequences of those choices.
 Better use
of languages that
are already known
 Bystudying the concepts of programming languages,
programmers can learn about previously unknown
and unused parts of the languages they already use
and begin to use those features.
 Overall advancement of
computing
 There is a global view of computing that can justify the study
of programming language concepts.
 For example, many people believe it would have been better if
ALGOL 60 had displaced Fortran in the early 1960s, because it
was more elegant and had much better control statements than
Fortran. That it did not is due partly to the programmers and
software development managers of that time, many of whom
did not clearly understand the conceptual design of ALGOL
60.
 If those who choose languages were better informed, perhaps,
better languages would eventually squeeze out poorer ones.
PROGRAMMING DOMAINS
 Scientific applications
 Large number of floating point computations. The most
common data structures are arrays and matrices; the most
common control structures are counting loops and
selections
 The first language for scientific applications was Fortran,
ALGOL 60 and most of its descedants
 Examples of languages best suited: Mathematica and
Maple
 Business applications

 Business languages are characterized by facilities for


producing reports, precise ways of describing and storing
decimal numbers and character data, and ability to specify
decimal arithmetic operations.
 Use decimal numbers and characters
 COBOL is the first successful high-level language for those
applications.
 Artificial intelligence

 Symbols rather than numbers are typically manipulated


 Symbolic computation is more conveniently done with
linked lists of data rather than arrays
 This kind of programming sometimes requires more
flexibility than other programming domains
 First AI language was LISP and is still most widely used
 Alternate languages to LISP are Prolog – Clocksin and
Mellish
 Systems programming
 The operating system and all of the programming support
tools of a computer system are collectively known as
systems software
 Need for efficiency because of continuous use
 Low-level features for interfaces to external devices
 C is extensively used for systems programming. The UNIX
OS is written almost entirely in C
 Web software

 Markup languages
 Such as XHTML
 Scripting languages
 A list of commands is placed in a file or in XHTML document for
execution
 Perl, JavaScript, PHP
 Special-purpose languages

 RPG – business reports


 APT – programmable machine tools
 GPSS – simulation
Language Evaluation Criteria

 Readability
 Writability
 Reliability
 Cost
 Other
 Readability
 One of the most important criteria for judging a
programming language is the ease with which programs
can be read and understood.
 Language constructs were designed more from the point
of view of the computer than of computer users
 From 1970s, the S/W life cycle concept was developed;
coding was relegated to a much smaller role, and
maintenance was recognized as a major part of the cycle,
particularly in terms of cost. Because ease of maintenance
is determined in large part by readability of programs,
readability became an important measure of the quality of
programs
Characteristics of Readability
Simplicity and orthogonality
Control statements
Datatypes and structures
Syntax considertion
- identifier forms
- special words
- form and meaning
 Overall simplicity
 Language with too many features is more difficult
to learn
 Feature multiplicity is bad. For example: In Java,
increment can be performed if four ways as:
 Count= count+1
 Count+=1

 Count++

 ++count
 Next problem is operator overloading, in which
single operator symbol has more than one meaning
 Orthogonality
 A relatively small set of primitive constructs that can be
combined in a relatively small number of ways
 Consistent set of rules for combining constructs
(simplicity)
 Every possible combination is legal
 For example, pointers should be able to point to any type
of variable or data structure
 Makes the language easy to learn and read
 Meaning is context independent
 VAX assembly language and Ada are good examples
 Lack of orthogonality leads to exceptions to rules
 C is littered with special cases
 E.g. - structs can be returned from functions but arrays cannot
 Orthogonality

Orthogonolity is closely related to simplicity.


The more orthogonal the design of a language, the
fewer exceptions the language rules require. Fewer
exceptions mean a higher degree of regularity in the
design, which makes the language easier to learn,
read, and understand.
 Writability
 Most readability factors also apply to writability
 Simplicity and orthogonality
 Control statements, data types and structures
 Support for abstraction
 Data abstraction
 Process abstraction
 Expressivity
 It is easy to express program ideas in the language
 APL is a good example
 In C, the notation C++ is more convenient and shorter than C = C + 1
 The inclusion of for statement in Java makes writing counting loops easier
than the use of while
 Reliability
A program is said to be reliable if performs to its specifications
under all conditions.
 Type checking
 Type checking is simply testing for type errors in a given program,
either by the compiler or during the program execution
 Because run time type checking is expensive, compile time type
checking is more desirable
 Famous failure of space shuttle experiment due to int / float mix-up in
parameter passing
 Exception handling
 Ability to intercept run-time errors
 Aliasing
 Ability to use different names to reference the same memory
 A dangerous feature
 Readability and writability both influence reliability
 Cost
 Training programmers to use language
 Writing programs in a particular problem domain
 Compiling programs
 Executing programs
 Language implementation system (free?)
 Reliability
 Maintaining programs
 Others: portability, generality, well-definedness
INFLUENCES ON LANGUAGE DESIGN

The basic design of programming languages


are influenced by the following factors:

1)Computer architecture
2)Programming methodologies
 Computer Architecture
 We use imperative languages, at least in part, because we
use von Neumann machines
 Data and programs stored in same memory
 Memory is separate from CPU
 Instructions and data are piped from memory to CPU
 Basis for imperative languages

 Variables model mmost efficient way to implement


repetitionemory cells
 Assignment statements model piping
 Iteration is the
Von Neumann computer architecture
 Programming methodologies
 1950s and early 1960s
 Simple applications
 Overriding concern about machine efficiency
 Late 1960s
 “People efficiency” became important
 Readability
 Better control structures
 Structured programming
 Top-down design and step-wise refinement
 Programming methodologies
 Late 1970s
 Process-oriented techniques yielded to data-oriented
techniques
 Data abstraction
 Middle 1980s to present
 Object-oriented programming
 Encapsulation with data abstraction
 Inheritance
 Dynamic method binding
 Smalltalk and Java
 Concurrent programming and parallelism
 Creating and controlling concurrent program units
LANGUAGE CATEGORIES
 Imperative
 Central features
 Variables
 Assignment statements
 Iteration
 Algorithm specified in detail with a specific order of execution
for statements
 C, Pascal, Visual BASIC.NET
 Functional
 Main means of making computations is by applying functions to
given parameters
 No variables
 No looping
 LISP, Scheme
 Logic
 Rule-based
 Rules are specified in no special order
 Language system chooses execution order that produces the desired result
 Prolog
 Object-oriented
 Encapsulate data objects with processing
 Inheritance and dynamic type binding
 Grew out of imperative languages
 Smalltalk, C++, Java
 Designing a programming language involves an
number of compromises and trade-offs
 Reliability vs. cost of execution
 Range checking for array references?
 Readability vs. writability
 The APL language traded readability for writability
 Writability vs. reliability
 Pascal variant records are flexible but not safe
 C++ pointers are flexible but not safe

LANGUAGE DESIGN
TRADE-OFFS
 Compilation
 Translates a high-level program to machine code
 Slow translation
 Fast execution
 Separate compilation units must be combined by a linker
into an executable image
(.exe file)

IMPLEMENTATION
METHODS
 Pure interpretation
 No translation before execution
 Slow execution
 Loop statements are repeatedly translated
 Becoming rare except for web scripting languages
 JavaScript
 PHP
 Hybrid implementation systems
 Translates a high-level language to intermediate code, which is interpreted
 Each statement is translated only once in contrast to pure interpretation
 Medium execution speed
 Smalltalk and Java
 Intermediate code is called bytecode
 The Java interpreter is the JVM
 JIT technology now widely used with Java and .NET
 The collection of tools used in software development
 File system, text editor, compiler, linker
 Eclipse
 An integrated development environment for Java and
other languages
 Microsoft Visual Studio.NET
 A large, complex visual environment
 Used to program in C#, Visual BASIC.NET, Jscript, J#,
and C++

PROGRAMMING
ENVIRONMENTS

You might also like