CSI 3125, Preliminaries, page 1 Programming languages and the process of programming –Programming means more than coding. –Why study programming languages?

Slides:



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

Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Chapter 1: Preliminaries
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Powered by DeSiaMore1 Programming Concepts David T. Makota Department of Computing & Information Technology (CIT) The Institute of Finance Management Dar.
Language Evaluation Criteria
PROGRAMMING LANGUAGES The Study of Programming Languages.
Chapter 17 Programming Tools The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
CS 355 – Programming Languages
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Chapter 1. Introduction.
HERY H AZWIR Computer Software. Computer Software Outline Software and Programming Languages  Software  Programming  Programming language development.
CS 363 Comparative Programming Languages
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
CST320 - Lec 11 Why study compilers? n n Ties lots of things you know together: –Theory (finite automata, grammars) –Data structures –Modularization –Utilization.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Topic #1: Introduction EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
6. Program Translation CS100: The World of Computing John Dougherty Haverford College.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
 Programming - the process of creating computer programs.
 Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language.
CSI 3125, Preliminaries, page 1 Preliminaries Programming languages and the process of programming. Criteria for the design and evaluation of programming.
Introduction to Language Programming Hierarchy of programming lang. Based on machine independences: 1. Machine language 2. Assembly language 3. Higher.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Programming Language Design Issues Programming Languages – Principles and Practice by Kenneth C Louden.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Advanced Computer Systems
Compiler Design (40-414) Main Text Book:
Concepts of Programming Languages
Introduction to Compiler Construction
PROGRAMMING LANGUAGES
课程名 编译原理 Compiling Techniques
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
Chapter 1 Introduction(1.1)
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Reasons To Study Programming Languages
Presentation transcript:

CSI 3125, Preliminaries, page 1 Programming languages and the process of programming –Programming means more than coding. –Why study programming languages? –Programming language paradigms and applications.

CSI 3125, Preliminaries, page 2 Programming languages and the process of programming Before coding begins, analyze the problem, design an algorithm, analyze the cost of the solution. After all coding has been done, maintain the program. Programming languages are used to instruct computers. –What do we communicate to computers? –How do computers talk back to us?

CSI 3125, Preliminaries, page 3 Programming languages and the process of programming How do programming languages differ from natural languages? Would talking to computers in human languages be preferable? What makes someone a good programmer? Should a good programmer know more than one programming language?

CSI 3125, Preliminaries, page 4 Why should we study programming languages? To understand better the connection between algorithms and programs. To be able to look for general, language- independent solutions. To have a choice of programming tools that best match the task at hand: –identify subtasks and apply to each of them the best language, using the full expressive power of each language.

CSI 3125, Preliminaries, page 5 To learn new programming languages easily and to know how to design new formal languages (for example, input data formats). To see how a language may influence the discipline of computing and strengthen good software engineering practice. Why should we study programming languages?

CSI 3125, Preliminaries, page 6 The many classes of programming languages: programming language paradigms Every programming language supports a slightly different or dramatically different style of problem solving. The same computation can be expressed in various languages, and then run on the same computer.

CSI 3125, Preliminaries, page 7 Programming languages classified by paradigm Imperative: how do we solve a problem (what steps does a solution have)? Logic-based: what do we do to solve a problem? (The language decides how to do it.) Functional: what simple operations can be applied to solving a problem, how are they mutually related, and how can they be combined? Object-oriented: what objects play roles in a problem, what can they do, and how do they interact to solve the problem?

CSI 3125, Preliminaries, page 8 Classification by generality of use General-purpose programming languages (most of the known languages are in this category); Specialized programming languages (for example, database languages, vector- processing languages, report generation languages, scripting languages, and more).

CSI 3125, Preliminaries, page 9 Classification by complication, abstraction, level Low-level languages (machine languages, assembly languages). High-level languages (most of the well-known languages belong in this category). Very high-level languages (Prolog is sometimes listed in this category, and some specialized languages). Beyond programming languages: –Programming environments, software development tools and workbenches.

CSI 3125, Preliminaries, page 10 Criteria for the design and evaluation of programming languages –Readability –Writability –Reliability –Cost

CSI 3125, Preliminaries, page 11 Readability This is subjective, but very important. Language readability is essential because of software engineering practices, and in particular the needs of software evolution and maintenance. –Abstraction—support for generality of programs: procedural abstraction, data abstraction. –Absence of ambiguity (and absence of too many coding choices, like having five different loop constructs).

CSI 3125, Preliminaries, page 12 Readability Expressivity of control and data structures. –what is better (easier to read, maintain and so on): –a longer program made of simple elements? –a shorter program built out of complex, specialized constructions? –Examples of high expressive power: recursion, built-in backtracking (as in Prolog), search in database languages. –Examples of low expressive power: instructions in machine or assembly languages. Appearance: syntax, including comments.

CSI 3125, Preliminaries, page 13 Writability Abstraction and simplicity: once more, subjective. –Pascal has always been considered simple, Ada—complicated –Basic is very simple –Prolog is conceptually simple, but may be difficult to learn. –is C++ simple? is Java? Expressivity again. Modularity and tools for modularization, support for integrated programming environments.

CSI 3125, Preliminaries, page 14 Reliability and Cost Reliability. –Safety for the programmer (type checking, error and exception handling, unambiguous names). Cost. –Development time (ease of programming, availability of shared code). –Efficiency of implementation: how easy it is to build a language processor (Algol 68 is a known failure, Ada almost a failure; Pascal, C, C++ and Java are notable successes). –Translation time and the quality of object code. –Portability and standardization.

CSI 3125, Preliminaries, page 15 Implementing programming languages –Language processors, virtual machines –Models of implementation –Compilation and execution

CSI 3125, Preliminaries, page 16 Language processors A processor for language L is any device (hardware or software) that understands and can execute programs in language L. Translation is a process of mapping a program in the source language into the target language, while preserving the meaning or function of the source program. The target language may be directly executable on the computer or (more often) may have to be translated again—into an even lower-level language.

CSI 3125, Preliminaries, page 17 Virtual machines A virtual machine is a software realization (simulation) of a language processor. Programming directly for hardware is very difficult—we usually "cover" hardware with layers of software. A layer may be shared by several language processors, each building its own virtual machine on top of this layer.

CSI 3125, Preliminaries, page 18 Examples of shared layers All language processors require support for input/output. All language processors eventually must do some calculations, that is, use the CPU.

CSI 3125, Preliminaries, page 19 Virtual machines We normally have hierarchies of virtual machines: –at the bottom, hardware; –at the top, languages close to the programmer's natural way of thinking. Each layer is expressed only in terms of the previous layer—this ensures proper abstraction.

CSI 3125, Preliminaries, page 20 A generic hierarchy of virtual machines Layer 0:hardware Layer 1:microcode Layer 2:machine language Layer 3:system routines Layer 4:machine-independent code Layer 5:high-level language (or assembler) Layer 6:application program Layer 7:input data [this is also a language!]

CSI 3125, Preliminaries, page 21 Virtual machines—examples Layer 0:IBM Netvista with Intel Pentium 4, 2GHz Layer 1:IBM Intel machine language Layer 2:Windows XP Layer 3:Java byte-code Layer 4:Java 2.0 (code developed in JRE 1.4.0) Layer 5:smart comparator of C++ programs, written in Java Layer 6:two C++ programs to compare for similarities

CSI 3125, Preliminaries, page 22 Virtual machines—examples (2) Layer 0:IBM Netvista with Intel Pentium 4, 2GHz Layer 1:IBM Intel machine language Layer 2:Windows NT 4.0 Layer 3:Java byte-code Layer 4:JDK 1.2 Layer 5:a Java implementation of Prolog Layer 6:a Prolog implementation of mySQL Layer 7:a database schema defined and created Layer 8:records for insertion into the database

CSI 3125, Preliminaries, page 23 Models of implementation Compilation: –translate the program into an equivalent form in a lower-layer virtual machine language; –execute later. Interpretation: –divide the program up into small (syntactically meaningful) fragments; –in a loop, translate and execute each fragment immediately.

CSI 3125, Preliminaries, page 24 Models of implementation Pure compilation and pure interpretation are seldom use. Normally, an implementation employs a mix of these models. –For example: compile Java into bytecodes, then interpret bytecodes. We consider a language processor an interpreter if it has "more interpretation than compilation". We consider a processor a compiler if there is more of compilation.

CSI 3125, Preliminaries, page 25 Models of implementation Some languages are better interpreted, for example interactively used Prolog or Lisp. Some languages are better compiled, for example, C++, Java. There can also be compiled Prolog or Lisp: –an interpretive top-level loop handles user interaction. –Predicates of functions are compiled into an optimized form which is then interpreted.

CSI 3125, Preliminaries, page 26 Compilation and execution Output DataInput Data Target Program Abstract Program (Optimized) Parse Tree Symbol Table Source program Code Optimization Semantic Analysis Loader / Linker Code Generation Computer Lexical Analysis (scanning) Syntactic Analysis (parsing) compiler Token Sequence Abstract Program (Intermediate code) Object Program (Native Code)