×
DREAM IT. BELIEVE IT. ACHIEVE IT.
--Your friends at LectureNotes
Close

Note for Principles of Programming Languages - ppl by Murali E

  • Principles of Programming Languages - ppl
  • Note
  • 5 Topics
  • 3453 Views
  • 30 Offline Downloads
  • Uploaded 3 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY ANANTAPUR B. Tech III-I Sem. (CSE) LTPC 3 1 03 15A05504 PRINCIPLES OF PROGRAMMING LANGUAGES Unit I: Introduction: Software Development Process, Language and Software Development Environments, Language and Software Design Models, Language and Computer Architecture, Programming Language Qualities, A brief Historical Perspective. Syntax and Semantics: Language Definition, Language Processing, Variables, Routines, Aliasing and Overloading, Run-time Structure. Unit II: Structuring the data: Built-in types and primitive types, Data aggregates and typeconstructors, User-defined types and abstract data types, Type Systems, The typeStructure of representative languages, Implementation Models Unit III: Structuring the Computation: Expressions and Statements, Conditional Executionand Iteration, Routines, Exceptions, Pattern Matching, Nondeterminism andBacktracking, Eventdriven computations, Concurrent Computations Structuring the Program: Software Design Methods, Concepts in Support ofModularity, Language Features for Programming in the Large, Generic Units Unit IV: Object-Oriented Languages: Concepts of Object-oriented Programming, Inheritancesand the type system, Object-oriented features in programming languages Unit V: Functional Programming Languages: Characteristics of imperative languages,Mathematical and programming functions, Principles of Functional Programming,Representative Functional Languages, Functional Programming in C++ Logic and Rule-based Languages: ―What‖ versus ―how‖: Specification versusimplementation, Principles of Logic Programming, PROLOG, Functional Programmingversus Logic Programming, Rule-based Languages Textbook: 1) ―Programming Language Concepts‖, Carlo Ghezzi, Mehdi Jazayeri, WILEY Publications. Third Edition, 2014 Reference Textbooks: 1. Concepts of Programming Languages, Tenth Edition, Robert W. Sebesta, PearsonEducation. 2. Programming Languages Principles and Paradigms, Second Edition, Allen B. Tucker,Robert E. Noonan, McGraw Hill Education. 3. Introduction to Programming Languages, Aravind Kumar Bansal, CRC Press.

Text from page-2

UNIT 1 Introduction Software Development Process: The software is said to have a life cycle com-posed of several phases. Each of these phases results in the development of either a part of the system or something associated with the system, such as a fragment of specification, a test plan or a user’s manual. In the traditional waterfall model of the software life cycle. A sample software development process based on the waterfall model may be comprised of the following phases: Requirement analysis and specification: The purpose of this phase is to identify and document the exact requirements for the system. These requirements are developed jointly by users and software developers. The result of this phase is a requirements document stating what the system should do, along with users' manuals, feasibility and cost studies, performance requirements, and so on. The requirements document does not specify how the system is going to meet its requirements. Software design and specification: Starting with the requirements document, software designers design the software system. The result of this phase is a system design specification document identifying all of the modules comprising the system and their interfaces. Implementation (coding): The system is implemented to meet the design specified in the previous phase. The design specification, in this case, states the ― what‖ ; the goal of the implementation step is to choose how, among the many possible ways, the system shall be coded to meet the design specification. The result is a fully implemented and documented system. Verification and validation: This phase assesses the quality of the implemented system, which is then delivered to the user. Note that this phase should not be concentrated at the end of the implementation step, but should occur in every phase of software development to check that intermediate deliverables of the process satisfy their objectives. The checks are accomplished by answering the following two questions: ―Are we building the product right?‖ ―Are we building the right product?‖ Two specific kinds of assessment performed during implementation are module testing and integration testing. Maintenance: Following delivery of the system, changes to the system may become necessary either because of detected malfunctions, or a desire to add new capabilities or to improve old ones, or changes that occurred in operational environment. Programming languages are used only in some phases of the development process. They are obviously used in the implementation phase, when algorithms and data structures are defined and coded for the modules that form the entire application. Moreover, modern higher-level languages are also used in the design phase, to describe precisely the decomposition of the entire application into modules, and the relationships among modules, before any detailed implementation takes place. Language and Software Development Environments: A software development environment we mean an integrated set of tools and techniques that aids in the development of software. The environment is used in all phases of

Text from page-3

software development: requirements, design, implementation, verification and validation, and maintenance. The work in any of the phases of software development may be supported by computer-aided tools. The phase currently supported best is the coding phase, with such tools as text editors, compilers, linkers, and libraries. These tools have evolved gradually, as the need for automation has been recognized. Nowadays, one can normally use an interactive editor to create a program and the file system to store it for future use. When needed, several previously created and (possibly) compiled programs may be linked to produce an executable program. A debugger is commonly used to locate faults in a program and eliminate them. These computer-aided program development tools have increased programming productivity by reducing the chances of errors. Language and Software Design Models: The relationship between software design methods and programming languages is an important one. To understand the relationship between a programming language and a design method, it is important to realize that programming languages may enforce a certain programming style, often called a programming paradigm. Here we review the most prominent programming language paradigms, with special emphasis on the unit of modularization promoted by the paradigm. Procedural programming: This is the conventional programming style, where programs are decomposed into computation steps that perform complex operations. Procedures and functions (collectively called routines) are used as modularization units to define such computation steps. Functional programming: The functional style of programming is rooted in the theory of mathematical functions. It emphasizes the use of expressions and functions. The functions are the primary building blocks of the program; they may be passed freely as parameters and may be constructed and returned as result parameters of other functions. Abstract data type programming: Abstract-data type (ADT) programming recognizes abstract data types as the unit of program modularity. CLU was the first language designed specifically to support this style of programming. Module-based programming: Rather than emphasizing abstract-data types, module-based programming emphasizes modularization units that are groupings of entities such as variables, procedures, functions, types, etc. A program is composed of a set of such modules. Modula-2 and Ada support this style of programming. Object-oriented programming: The object-oriented programming style emphasizes the definition of classes of objects. Instances of classes are created by the program as needed during program execution. This style is based on the definition of hierarchies of classes and run-time selection of units to execute. Smalltalk and Eiffel are representative languages of this class. C++ and Ada 95 also support the paradigm. Generic programming: This style emphasize the definition of generic modules that may be instantiated, either at compile-time or runtime, to create the entities data structures, functions, and procedures needed to form the program. This approach to programming encourages the development of high-level, generic, abstractions as units of modularity. It can exist jointly

Text from page-4

with object-oriented programming, as in Eiffel, with functional programming, as in ML. It also exists in languages that provide more than one paradigm, like Ada and C++. Declarative programming: This style emphasizes the declarative description of a problem, rather than the decomposition of the problem into an algorithmic implementation. As such, programs are close to a specification. Logic languages, like PROLOG, and rule-based languages, like OPS5 and KEE, are representative of this class of languages. Language and Computer Architecture: Languages have been constrained by the ideas of Von Neumann, because most current computers are similar to the original Von Neumann architecture Figure 1. A Von Neumann computer architecture The Von Neumann architecture, sketched in Figure 1, is based on the idea of a memory that contains data and instructions, a CPU, and an I/O unit. The CPU is responsible for taking instructions out of memory, one at a time. Machine instructions are very low-level. They require the data to be taken out of memory, manipulated via arithmetic or logic operations in the CPU, and the results copied back to some memory cells. Thus, as an instruction is executed, the state of the machine changes. Conventional programming languages can be viewed as abstractions of an underlying Von Neumann architecture. For this reason, they are called Von Neumann languages. An abstraction of a phenomenon is a model which ignores irrelevant details and highlights the relevant aspects. Conventional languages based on the Von Neumann computation model are often called imperative languages. Other common terms are state-based languages, or statement-based languages, or simply Von Neumann languages. The historical developments of imperative languages have gone through increasingly higher levels of abstractions. In the early times of computing,. Many kinds of abstractions were later invented by language designers, such as procedures and functions, data types, exception handlers, classes, concurrency features, etc. As suggested by Figure 2, language developers tried to make the level of programming languages higher, to make languages easier to use by humans, but still based the concepts of the language on those of the underlying Von Neumann architecture.

Lecture Notes