1 / 21

CS 363 Comparative Programming Languages

CS 363 Comparative Programming Languages. Introduction. Chapter 1 Topics. Motivation Language Paradigms Programming Domains Language Design and Evaluation Influences Tradeoffs Implementation options. Programming Languages. Languages are an abstraction used by the

trapper
Download Presentation

CS 363 Comparative Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 363 Comparative Programming Languages Introduction

  2. Chapter 1 Topics • Motivation • Language Paradigms • Programming Domains • Language Design and Evaluation • Influences • Tradeoffs • Implementation options CS 363 GMU Spring 2005

  3. Programming Languages • Languages are • an abstraction used by the • programmer to express an idea • interface to the underlying • computer architecture Sebesta Fig. 1.2 CS 363 GMU Spring 2005

  4. Why study Programming Languages? • Increases ability to express ideas in a language • wide variety of programming features • Improves ability to choose appropriate language • Each language has strengths and weaknesses in term of expressing ideas • Improves ability to learn new languages • different paradigms, different features • What does the future of programming languages hold? • Improves understanding of significance of implementation • Provides ability to design new languages • Domain specific languages increasingly popular CS 363 GMU Spring 2005

  5. Language Paradigms • Imperative • Central features are variables, assignment statements, and iteration • Ex: C, Pascal, Fortran • Object-oriented • Encapsulate data objects with processing • Inheritance and dynamic type binding • Grew out of imperative languages • Ex: C++, Java • Functional • Main means of making computations is by applying functions to given parameters • Ex: LISP, Scheme, Haskell CS 363 GMU Spring 2005

  6. Language Paradigms • Logic • Declarative  Rule-based – implicit control flow • Ex: Prolog • Dataflow • Declarative  Model computation as information flow – implicit control flow • Inherently parallel • Event-Driven • Continuous loop with handlers that respond to events generated in unpredictable order, such as mouse clicks • Often an add-on feature • Ex: Java • Concurrent • Multiple interacting processes • Often an add-on feature • Ex: Java, High Performance Fortran (HPF), Linda CS 363 GMU Spring 2005

  7. Programming Domains • Scientific applications • One of the earliest uses of computers • Large number of floating point computations • Long running • Imperative (Fortran, C) and Parallel (High Performance Fortran) • Business applications • Produce reports, use decimal numbers and characters • Increasingly toward web-centric (Java, Perl, XML-based languages) • Imperative (Cobol) and domain specific (SQL) • Artificial intelligence • Model human behavior and deduction • Symbol manipulation • Functional (Lisp) and Logical (Prolog) • Systems programming • Need efficiency because of continuous use • Parallel and event driven • Imperative (C) • … CS 363 GMU Spring 2005

  8. Language Design • Principles of Design • Influences on Design • Evaluation of a design CS 363 GMU Spring 2005

  9. Principles of Language Design Basic Vocabulary: • Syntax – what constitutes a correctly written program • Type Systems and Semantics – these allow us to provide a meaning to a syntatically correct program. • Memory management – data mapping, static and dynamic memory, stack, heap, object lifetime, garbage collection • Exception handling – how to deal with unexpected problems at runtime CS 363 GMU Spring 2005

  10. Von Neumann architecture: 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 memory cells Assignment statements model piping Iteration is efficient Influences on Language Design CS 363 GMU Spring 2005

  11. Influences on Language Design • Programming methodologies • 1950s and early 1960s: Simple applications; worry about machine efficiency • Late 1960s: People efficiency became important; readability, better control structures • Structured programming • Top-down design and step-wise refinement • Late 1970s: Process-oriented to data-oriented • data abstraction • Middle 1980s: Object-oriented programming CS 363 GMU Spring 2005

  12. Influences on Program Design • Special Purpose (Domain Specific) • Abstraction closer to problem domain • Personal Preferences • terse vs. verbose • recursion vs. iteration • user controlled vs. language controlled dynamic allocation CS 363 GMU Spring 2005

  13. Language Evaluation Criteria • Readability – most important! • Overall simplicity • Orthogonality – A relatively small set of primitive constructs that can be combined in a relatively small number of ways • Makes the language easy to learn and read • Meaning is context independent • Every possible combination is legal • Lack of orthogonality leads to exceptions to rules • Control statements • Defining data types and structures • Syntax considerations: identifier forms, special words, meaning CS 363 GMU Spring 2005

  14. Language Evaluation Criteria • Writability • Simplicity and orthogonality • Support for abstraction • Expressivity • Reliability • Conformance to specs. • Type checking • Exception handling • Aliasing • Readability and writability CS 363 GMU Spring 2005

  15. Language Evaluation Criteria • Cost • Categories • Training programmers to use language • Writing programs • Compiling programs • Executing programs • Language implementation system • Maintaining programs (readability) • Safety – prevention of unchecked errors • Others: portability, generality, well-definedness CS 363 GMU Spring 2005

  16. Language Implementation Options • Compilers • Interpreters • Hybrid options CS 363 GMU Spring 2005

  17. Compilers Syntactic/semantic structure tokens Syntactic structure Scanner (lexical analysis) Parser (syntax analysis) Semantic Analysis (IC generator) Code Generator Source language Machine language Code Optimizer Input Data Computer Symbol Table Output CS 363 GMU Spring 2005

  18. Interpreters Interpreter Source language Output Input Data CS 363 GMU Spring 2005

  19. Compilation: Translate HL code directly into machine Translation can be slow Resulting code is fast (typically optimized) Interpretation: Execute HL code directly No translation costs Execution can be slow Compilation vs. Interpretation CS 363 GMU Spring 2005

  20. Hybrid tokens Syntactic structure Scanner (lexical analysis) Parser (syntax analysis) Semantic Analysis (IC generator) Source language Input Data Intermediate Code Interpreter Symbol Table Output CS 363 GMU Spring 2005

  21. What makes a language successful? • Expressive Power • Included features impact programmer use • Ease of use for Novice • Pascal, Basic, Logo • Ease of Implementation • Excellent Compilers • Economics, Patronage, Legacy CS 363 GMU Spring 2005

More Related