ProgrammingLanguages Programming Languages Language Abstraction and Computational Paradigms.

Slides:



Advertisements
Similar presentations
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Advertisements

Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
The Assembly Language Level
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Compiler Principle and Technology Prof. Dongming LU Mar. 28th, 2014.
you admittance to the “show”.
VBA Modules, Functions, Variables, and Constants
Chapter Chapter Goals Describe the layers of a computer system Describe the concept of abstraction and its relationship to computing Describe.
Overview of Programming Paradigms
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Programming Languages Structure
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Introduction to a Programming Environment
Chapter 1 Program Design
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Chapter 2: Algorithm Discovery and Design
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
Final Exam Review Instructor : Yuan Long CSC2010 Introduction to Computer Science Apr. 23, 2013.
Chapter 01 Nell Dale & John Lewis.
Language Evaluation Criteria
PROGRAMMING LANGUAGES The Study of Programming Languages.
CSE 425: Intro to Programming Languages and their Design A Few Key Ideas No particular language is a prerequisite for this course –However you should be.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
High-Level Programming Languages: C++
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
ProgrammingLanguages Programming Languages Computational Paradigms.
Simple Program Design Third Edition A Step-by-Step Approach
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Tranlators. Machine Language The lowest-level programming languageprogramming language Machine languages are the only languages understood by computers.languagescomputers.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Chapter 1 - Introduction
Principles of Programming Languages Asst. Prof. Dr. Ahmet Sayar Spring-2012 Kocaeli University Computer Engineering Department Introduction.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Computer Concepts 2014 Chapter 12 Computer Programming.
Chapter 6 Programming Languages. © 2005 Pearson Addison-Wesley. All rights reserved 6-2 Chapter 6: Programming Languages 6.1 Historical Perspective 6.2.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Chapter 6 Programming Languages © 2007 Pearson Addison-Wesley. All rights reserved.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
ProgrammingLanguages Programming Languages Language Definition, Translation and Design.
Copyright © 2015 Pearson Education, Inc. Chapter 6: Programming Languages.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
SWE 4743 Abstraction Richard Gesick. CSE Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
Programming Languages Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Programming Language Paradigms ITSK2314 Lecture 3.
Lecture 2 Introduction to Programming
Computer Programming.
CSCE Fall 2013 Prof. Jennifer L. Welch.
Chapter 6: Programming Languages
CSCE Fall 2012 Prof. Jennifer L. Welch.
Von Neumann Architecture
Principles of Programming Languages
Programming Languages, Preliminaries, History & Evolution
Presentation transcript:

ProgrammingLanguages Programming Languages

Language Abstraction and Computational Paradigms

Objectives How we communicate influences how we think, and vice versa.How we communicate influences how we think, and vice versa. Similarly, how we program computers influences how we think about them, and vice versa.Similarly, how we program computers influences how we think about them, and vice versa. It is the goal of this lesson to introduce the major principles and concepts underlying all programming languages.It is the goal of this lesson to introduce the major principles and concepts underlying all programming languages.

What is a Programming language?(1) A simple definition could be ” a notation for communicating to a computer what we want it to do." But this definition is inadequate.A simple definition could be ” a notation for communicating to a computer what we want it to do." But this definition is inadequate. A major advance in computer design occurred in the 1940s, when John von Neumann had the idea that a computer should not be "hard-wired" to do particular things, but that a series of codes stored as data would determine the actions taken by a central processing unit.A major advance in computer design occurred in the 1940s, when John von Neumann had the idea that a computer should not be "hard-wired" to do particular things, but that a series of codes stored as data would determine the actions taken by a central processing unit. von Neumann Machine:von Neumann Machine:

Soon programmers realized that it would be a tremendous help to attach symbols to the instruction codes, as well as to memory locations, and assembly language was born, with instructions such as LDA #2 STA XSoon programmers realized that it would be a tremendous help to attach symbols to the instruction codes, as well as to memory locations, and assembly language was born, with instructions such as LDA #2 STA X But assembly language, because of its machine dependence, low level of abstraction, and difficulty in being written and understood, is also not what we usually think of as a programming language.But assembly language, because of its machine dependence, low level of abstraction, and difficulty in being written and understood, is also not what we usually think of as a programming language. Assembly Language

programmers soon realized that a higher level of abstraction would improve their ability to write concise, understandable instructions that could be used with little change from machine to machine.programmers soon realized that a higher level of abstraction would improve their ability to write concise, understandable instructions that could be used with little change from machine to machine. Certain standard constructions, such as assignment, loops, and selections or choices, were constantly being used and had nothing to do with the particular machine; these constructions should be expressible in simple standard phrases that could be translated into machine-usable form.Certain standard constructions, such as assignment, loops, and selections or choices, were constantly being used and had nothing to do with the particular machine; these constructions should be expressible in simple standard phrases that could be translated into machine-usable form. Higher Level of Abstraction

An area of memory where both programs and data are stored and a separate central processing unit that sequentially executes instructions fetched from memory.An area of memory where both programs and data are stored and a separate central processing unit that sequentially executes instructions fetched from memory. High Level: von Neumann Model Programs thus became relatively machine independent, but the language still reflected the underlying architecture of the von Neumann model of a machine:Programs thus became relatively machine independent, but the language still reflected the underlying architecture of the von Neumann model of a machine: Such as the C for the previous assembly language instructions (indicating assignment of the value 2 to the location with name X) X = 2;Such as the C for the previous assembly language instructions (indicating assignment of the value 2 to the location with name X) X = 2;

but need only describe computation or processing in general.but need only describe computation or processing in general. Non-von Neumann model With increasing abstraction, and with the development of new architectures, particularly parallel processors, came the realization that programming languages need not be based on any particular model of computation or machine,With increasing abstraction, and with the development of new architectures, particularly parallel processors, came the realization that programming languages need not be based on any particular model of computation or machine, Most modem programming languages still retain the flavor of this processor model of computation: sequential computation.Most modem programming languages still retain the flavor of this processor model of computation: sequential computation.

Computation.Computation. A Formal Definition: Three key concepts in this definition.Three key concepts in this definition. A programming language is a notational system for describing computation in machine-readable and human-readable form.A programming language is a notational system for describing computation in machine-readable and human-readable form. Machine readabilityMachine readability Human readabilityHuman readability

Computation The generally accepted Church’s thesis states that it is not possible to build a machine that is inherently more powerful than a Turing machine.The generally accepted Church’s thesis states that it is not possible to build a machine that is inherently more powerful than a Turing machine. Computation is usually defined traditionally using the mathematical concept of a Turing machine.Computation is usually defined traditionally using the mathematical concept of a Turing machine.

Turing machine Turing machine is a kind of computer whose operation is simple enough to be described with great precision. Such a machine needs also to be powerful enough to perform any computation that a computer can.Turing machine is a kind of computer whose operation is simple enough to be described with great precision. Such a machine needs also to be powerful enough to perform any computation that a computer can.

General View of Computation Computation instead includes all kinds of computer operations, including data manipulation, text processing, and information storage and retrieval.Computation instead includes all kinds of computer operations, including data manipulation, text processing, and information storage and retrieval. We will think of computation as any process that can be carried out by a computer.We will think of computation as any process that can be carried out by a computer. Sometimes a programming language will be designed with a particular kind of processing in mind, such as report generation, graphics, or database maintenance.Sometimes a programming language will be designed with a particular kind of processing in mind, such as report generation, graphics, or database maintenance.

Machine Readability First, there must be an algorithm to translate a language, that is, a step-by-step process that is unambiguous and finite.First, there must be an algorithm to translate a language, that is, a step-by-step process that is unambiguous and finite. For a language to be machine-readable, it must have a simple enough structure to allow for efficient translation.For a language to be machine-readable, it must have a simple enough structure to allow for efficient translation. Second, the algorithm cannot have too great a complexity.Second, the algorithm cannot have too great a complexity. Usually, machine readability is ensured by restricting the structure of a programming language to that of the so-called context-free languages.Usually, machine readability is ensured by restricting the structure of a programming language to that of the so-called context-free languages.

Human Readability Human readability requires that a programming language provide abstractions of the actions of computers that are easy to understand, even by persons not completely familiar with the underlying details of the machine.Human readability requires that a programming language provide abstractions of the actions of computers that are easy to understand, even by persons not completely familiar with the underlying details of the machine. The development of such abstraction mechanisms has been one of the important advances in programming language.The development of such abstraction mechanisms has been one of the important advances in programming language.

Human Readability Human readability requires that a programming language provide abstractions of the actions of computers that are easy to understand, even by persons not completely familiar with the underlying details of the machine.Human readability requires that a programming language provide abstractions of the actions of computers that are easy to understand, even by persons not completely familiar with the underlying details of the machine. The development of such abstraction mechanisms has been one of the important advances in programming language.The development of such abstraction mechanisms has been one of the important advances in programming language. Nowaday, a programming language is no longer a way of describing computation, but it becomes part of a software development environment that promotes a software design methodology.Nowaday, a programming language is no longer a way of describing computation, but it becomes part of a software development environment that promotes a software design methodology.

Language Abstractions Programming language abstractions fall into two general categories: Data abstraction, and Control abstraction.Programming language abstractions fall into two general categories: Data abstraction, and Control abstraction. Data abstractions abstract properties of the data, such as character strings, numbers, or search trees, which is the subject of computation.Data abstractions abstract properties of the data, such as character strings, numbers, or search trees, which is the subject of computation. Control abstractions abstract properties of the transfer of control, that is, the modification of the execution path of a program based on the situation at hand. Examples of control abstractions are loops, conditional statements, and procedure calls.Control abstractions abstract properties of the transfer of control, that is, the modification of the execution path of a program based on the situation at hand. Examples of control abstractions are loops, conditional statements, and procedure calls.

Levels of Abstractions Programming language abstractions also fall into levels:Programming language abstractions also fall into levels: Basic abstractions collect together the most localized machine information.Basic abstractions collect together the most localized machine information. Structured abstractions collect more global information about the structure of the program.Structured abstractions collect more global information about the structure of the program. Unit abstractions collect information about entire pieces of a program.Unit abstractions collect information about entire pieces of a program.

Data Abstractions: Basic abstractions Basic abstractions. Basic data abstractions in programming languages abstract the internal representation of common data values in a computer.Basic abstractions. Basic data abstractions in programming languages abstract the internal representation of common data values in a computer. Data types of basic data values are usually given the names of their corresponding mathematical values, such as integer and real.Data types of basic data values are usually given the names of their corresponding mathematical values, such as integer and real. Variables are given names and data types using a declaration, such as the Pascal var x: integer; or the equivalent C declaration int x;Variables are given names and data types using a declaration, such as the Pascal var x: integer; or the equivalent C declaration int x;

Data Abstractions: Structured abstractions The data structure is the principal method for abstracting collections of data values that are related.The data structure is the principal method for abstracting collections of data values that are related. A typical data structure provided by programming languages is the array:A typical data structure provided by programming languages is the array: Variables can be given a data structure in a declaration, as in the C: int a[10];Variables can be given a data structure in a declaration, as in the C: int a[10]; Data structures can also be viewed as new data types that are not internal, but are constructed by the programmer as needed, such as the C: typedef int Intarray[10];Data structures can also be viewed as new data types that are not internal, but are constructed by the programmer as needed, such as the C: typedef int Intarray[10];

Data Abstractions: Unit abstractions In a large program, it is useful and even necessary to collect all the information needed for the creation and use of a data type into one location and to restrict the access to the details of the data type.In a large program, it is useful and even necessary to collect all the information needed for the creation and use of a data type into one location and to restrict the access to the details of the data type. This ensures that changes in the structure of the data type do not affect large areas of the program and that programmers need not keep all the details of a data type in mind at all timesThis ensures that changes in the structure of the data type do not affect large areas of the program and that programmers need not keep all the details of a data type in mind at all times This mechanism is called a data encapsulation or, more commonly, an abstract data type mechanism.This mechanism is called a data encapsulation or, more commonly, an abstract data type mechanism.

Control Abstractions: Basic abstractions Typical basic control abstractions are those statements in a language that combine a few machine instructions into a more understandable abstract statement.Typical basic control abstractions are those statements in a language that combine a few machine instructions into a more understandable abstract statement. The assignment statement is a typical instruction that abstracts the computation and storage of a value into the location given by a variable, as for example, x=x+3;The assignment statement is a typical instruction that abstracts the computation and storage of a value into the location given by a variable, as for example, x=x+3; Another typical basic control statement is the goto statement in Fortran: GOTO 10 …….. 10 CONTINUEAnother typical basic control statement is the goto statement in Fortran: GOTO 10 …….. 10 CONTINUE

Control Abstractions: Structured abstractions Structured control abstractions divide a program into groups of instructions that are nested within tests that govern their execution.Structured control abstractions divide a program into groups of instructions that are nested within tests that govern their execution. Typical examples are selection statements, such as the if-statement of many languages, the case- statement of Pascal, and the switch-statement of C.Typical examples are selection statements, such as the if-statement of many languages, the case- statement of Pascal, and the switch-statement of C. Structured looping mechanisms come in many forms, including the while, and for loops of C.Structured looping mechanisms come in many forms, including the while, and for loops of C.

Control Abstractions: Structured abstractions A further, powerful mechanism for structuring control is the procedure, sometimes also called a subprogram or subroutine.A further, powerful mechanism for structuring control is the procedure, sometimes also called a subprogram or subroutine. Procedure call is a more complex mechanism than selection or looping, since it requires the storing of information about the condition of the program at the point of the call and the way the called procedure operates.Procedure call is a more complex mechanism than selection or looping, since it requires the storing of information about the condition of the program at the point of the call and the way the called procedure operates. Such information is stored in a runtime environment.Such information is stored in a runtime environment.

Control Abstractions: Unit abstractions Control can also be abstracted to include a collection of procedures that provide logically related services to other parts of a program and that form a unit, or standalone, part of the program.Control can also be abstracted to include a collection of procedures that provide logically related services to other parts of a program and that form a unit, or standalone, part of the program. Examples of unit abstractions include the package of Java and Ada.Examples of unit abstractions include the package of Java and Ada.

Parallel Abstractions One kind of control abstraction that does not fit into any one abstraction level is that of parallel programming mechanisms.One kind of control abstraction that does not fit into any one abstraction level is that of parallel programming mechanisms. Ada provides the task mechanism for parallel execution.Ada provides the task mechanism for parallel execution. Ada’s tasks are essentially a unit abstraction.Ada’s tasks are essentially a unit abstraction. Other languages provide different levels of parallel abstractions, such as Java’s threads.Other languages provide different levels of parallel abstractions, such as Java’s threads.

Turing Completeness It is worth noting that almost all abstraction mechanisms are provided for human readability.It is worth noting that almost all abstraction mechanisms are provided for human readability. If a programming language needs to describe only computation, then it needs only enough mechanisms to be able to describe all the computations that a Turing machine can perform, Such a language is called Turing complete.If a programming language needs to describe only computation, then it needs only enough mechanisms to be able to describe all the computations that a Turing machine can perform, Such a language is called Turing complete. A programming language is Turing complete provided it has integer variables and arithmetic and sequentially executes statements, which include assignment, selection (if) and loop (while)statements.A programming language is Turing complete provided it has integer variables and arithmetic and sequentially executes statements, which include assignment, selection (if) and loop (while)statements.