I find that the harder I work, the more luck I seem to have.
--Your friends at LectureNotes

Note for Principles of Programming Languages - ppl By Parag Goyal

  • Principles of Programming Languages - ppl
  • Note
  • 3 Offline Downloads
  • Uploaded 2 months ago
Parag Goyal
Parag Goyal
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Subject Name: Principles of Programming Languages Subject Code: CS-6002 Semester: 6th

Text from page-2

Downloaded from be.rgpvnotes.in Subject Notes Department of Computer Science and Engineering Subject Name: PPL Subject Code:CS6002 Unit-1 Language Evaluation Criteria The following factors influences Language evaluation criteria 1) Readability 2) Simplicity 3) Orthogonality 4) Writability 5) Reliability 6) Cost 1. 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 2. 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. 3. 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 • Lack of orthogonality leads to exceptions to rules • C is littered with special cases Orthogonality 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. – Useful control statements – Ability to define data types and structures – Syntax considerations 4. Writability - Writability is a measure of how easily a language can be used to create programs for a chosen problem domain and can be directly related to: – Most readability factors also apply to writability – Simplicity and orthogonality – Control statements, data types and structures – Support for abstraction 5. ReliabilityA 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 Page no: 1 Follow us on facebook to get real-time updates from RGPV

Text from page-3

Downloaded from be.rgpvnotes.in • 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 • A ility to intercept run-time errors • A ility to use different names to reference the same memory • A dangerous feature 6. CostThe cost is also an important language evaluation criteria. The total cost of a programming is a function of cost of training to programmers, cost of writing programs, cost of compiling programs, cost of executing programs, cost of maintaining programs. Influence on Language design 1. Computer Architecture 2. Programming Methodologies Computer Architecture Influence – Data and programs stored in memory – Memory is separate from CPU – Instructions and data are piped from memory to CPU – Basis for imperative languages • Variables model memory cells • Assignment statements model piping • Iteration is efficient Programming Methodologies Influences  structured programming – top-down design and step-wise refinement  Process-oriented to data-oriented – Data abstraction  Object-oriented programming – Data abstraction + inheritance + polymorphism Programming Domain  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 descendants. 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. Its uses for decimal numbers and characters. COBOL is the first successful high-level language for those applications. • Artificial intelligence- In AI 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. The first AI language was LISP and is still most widely used • Systems programming- The operating system and all of the programming support tools of a computer system are collectively known as systems software. It needs for efficiency because of continuous use and lowlevel features for interfaces to external devices Page no: 2 Follow us on facebook to get real-time updates from RGPV

Text from page-4

Downloaded from be.rgpvnotes.in • Special-purpose languages – RPG (Report Program Generator) : business reports – APT (Automatically Programmed Tool) programmable machine tools – GPSS (General Purpose Simulation System ) : simulation Language CategoriesThe four categories usually recognized are imperative, object-oriented, functional, and logic. Each Language category has some special features. Programming Paradigms 1. Imperative- imperative programming is a programming paradigm that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates. Examples: C, Pascal 2. Object-oriented-Stands for "Object-Oriented Programming." OOP refers to a programming methodology based on objects, instead of just functions and procedures. These objects are organized into classes, which allow individual objects to be group together. Most modern programming languages including Java, C/C++, and PHP, are object-oriented languages, and many older programming languages now have object-oriented versions. An "object" in an OOP language refers to a specific type, or "instance," of a class. Each object has a structure similar to other objects in the class, but can be assigned individual characteristics. An object can also call functions, or methods, specific to that object. For example, the source code of a video game may include a class that defines the structure of characters in the game. Individual characters may be defined as objects, which allow them to have different appearances, skills, and abilities. They may also perform different tasks in the game, which are run using each object's specific methods. Examples: Java, C++ 3. Functional-Functional programming languages are specially designed to handle symbolic computation and list processing applications. Functional programming is based on mathematical functions. Some of the popular functional programming languages include: Lisp, Python etc. Examples: LISP, Scheme Functional programming languages are categorized i to t o g oups, i.e. −  Pure Functional Languages − these t pes of fu tio al la guages suppo t o l the fu tio al pa adig s. Fo e a ple − Haskell.  Impure Functional Languages − these t pes of fu tio al la guages suppo t the fu tio al pa adig s a d impe ati e st le p og a i g. Fo e a ple − LI“P. Functional Programming – Characteristics Functional programming languages are designed on the concept of mathematical functions that use conditional expressions and recursion to perform computation.  Functional programming supports higher-order functions and lazy evaluation features.  Fu tio al p og a i g la guages do ’t suppo t flo Co t ols like loop state e ts a d o ditio al statements like If-Else and Switch Statements. They directly use the functions and functional calls.  Like OOP, functional programming languages support popular concepts such as Abstraction, Encapsulation, Inheritance, and Polymorphism. 4. Logic (declarative)- A logic program consists of a set of axioms and a goal statement. The rules of inference are applied to determine whether the axioms are sufficient to ensure the truth of the goal statement. The Page no: 3 Follow us on facebook to get real-time updates from RGPV

Lecture Notes