Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction
|
|
- Moses Leslie Kelley
- 6 years ago
- Views:
Transcription
1 Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction to the different Programming Paradigm The different programming paradigm Why different paradigms? Introduction to Functional Expressions Functions Control Recursion Advantages and inconvenient of functional programming 2 / 66 Course goals Course Introduction Describe aspects of evaluation and execution in different language models Explain and demonstrate how design choices affect the expressiveness and efficacy of a programming language Analyze and value programming languages based on their evaluation and compilation strategies Implement programming languages in the form of an interpreter and a compiler 4
2 Why do you need to know how program are interpreted? It will help you understand why programming language works a certain way and what are the limits New programming languages and interpreters are constantly being developed Existing interpreters are constantly being developed to improve performance, security, add new features... Programming languages General purposes: C, C++, Java, Python... Special purposes: Prolog, Matlab, R, Agent0... Scripting: JavaScript, VBA... Historical: Fortran, Lisp Evolution of programming languages How is a program interpreted? Source code Parser Parser Abstract Syntax Tree Tree visitor Generator Source code... Bytecode Virtual Machine Assembler Assembly Operating System CPU 7 8
3 Facebook's work on the PHP intepreter Why did Facebook need to develop their own PHP interpreter? Facebook started with PHP in 2004 Back at the time, PHP was the gold standard for website programming and prototyping But this is causing problems and for practical reasons they cannot change programming language 9 10 What did Facebook do? The standard PHP interpreter is using Abstract Syntax Tree execution They developed a tool to convert PHP to C++ Then they developed a new interpreter that do Just-In-Time (JIT) compilation, called HHVM They introduced Hack, a variant of PHP with a typing system And other examples... Google with Java, Dalvik, Python with CPython vs Qt's JavaScript, switching from AST Interpretation to JIT and to a mix of JIT and AST Interpretation
4 List of lectures 1 Introduction and Functional Programming 2 Imperative Programming and Data Structures 3 Environment 4 Evaluation 5 Object Oriented Programming 6 Macros and 7 Virtual Machines and Bytecode 8 Garbage Collection and Native Code 9 Distributed Computing 10 Logic 11 Guest lecture 12 Summary Book(s) Structure and Interpretation of Computer Programs by Hal Abelson, Jerry Sussman and Julie Sussman Structure and Interpretation of Computer Programs in Python by Hal Abelson, Jerry Sussman, Julie Sussman and John Denero List of labs 1Functional Programming 2Supporting class for an interpreter 3ECMAScript Interpreter 4Macros 5Supporting class for a Virtual Machine 6Bytecode and Virtual Machine The labs are entirely new and using Python Division of time 24h lectures (in 12 sessions) 40h labs (in 20 sessions) 8h tutorials (in 4 88h homework 15 16
5 Introduction to the different Programming Paradigm The different programming paradigm Programming Paradigm (2/2) declarative Imperative functional Symbolic Logic Object-Oriented 19 20
6 Declarative Expresses logic of computation without control flow: What should be computed and not how it should be computed. Examples: XML/HTML, antlr4/yacc, make/ants... Imperative Express how computation are executed Describes computation in term of statements that change the internal state Examples: C/C++, Pascal, Java, Python, JavaScript Functional Computation are treated as mathematical function without changing any internal state Examples: Lisp, Scheme, Object-Oriented Based on the concept of objects, which are data structures containing fields and methods Programs are designed by making objects interact with each others Examples: C++, Java, C#, Python, Ruby, JavaScript
7 Others paradigm languages Logic Based on Formal logic: expressing facts and rules Symbolic A program can manipulate its own formulas and components as if they are data Example: prolog Why different paradigms? 25 Can you do everything in imperative programming? Is there a paradigm to rule them all? In theory you can program everything in C/C++ and impertive programming But is that And is that 27 28
8 Functional vs Imperative Declarative vs Imperative Double all the numbers in an array var numbers = Imperative: var doubled = [] for(var i = 0; i < numbers.length; i++) var newnumber = numbers[i] * 2 doubled.push(newnumber) Functional: var doubled = numbers.map(function(n) return n * 2 ) Select all the dogs that belongs to a specific Declarative: SELECT * from dogs INNER JOIN owners WHERE dogs.owner_id = owners.id Imperative: var dogswithowners = [] var dog, owner for(var dog in dogs) for(var owner in owners) if (owner && dog.owner_id == owner.id) dogswithowners.push( dog: dog, owner: owner ) Functional vs Imperative Imperative language (C/C++, Basic constructs are imperative Change existing values, states x = x + Functional language Basic constructs are Declare new values function f(x) return x + 1; Computations are primarily done by evaluating expressions Pure if all constructs are declarative Introduction to Functional Programming 31
9 Expressions (1/2) Expressions primitive expressions to capture the simplest elements we want to describe means of combining simple elements into coumpound ones means of abstracting elements by naming and manipulating them 34 Expressions (2/2) Primitive expression: numbers, arithmetic expressions... 2 plus 'hello' number operator string Call max ( 2, 3 ) operator operand operand Compound expressions max(min(pow(3, 5), -4), min(1, -2) * 2) + 6 Names Expressions can be named 2 plus 'hello' name a plus b name name name max ( 2, 3 ) name 35 36
10 Assignment Binds names to a := 2 Now a has the value 2 a plus 2 evaluates to 4 Question What is the value of the final expression in this sequence? >>> f = min >>> g = max >>> g, h = min, max >>> max = g >>> max(f(2, g(h(1,5), 3)), 4) enter code What is a function? Functions Assignment is a simple means of abstraction: binds names to values Function definition is a more powerful means of abstraction: binds names to expressions 40
11 Function definition A function definition contains: A signature which defines how many arguments a function takes A body which defines the computation performed when the function is called function <name> ( parameters list ) return <return expression> ; Pure and non-pure function Pure functions: just return values: Math.abs(-2) -> Math.pow(2, 100) -> Non-pure functions: have side effects: print(-2) -> But print '-2' in the A side effect is not a value, it is anything that happens as a consequence of calling a What is a closure/lambda? Closure (or lambda) A closure is a function with no var doubled = numbers.map(function(n) return n * 2 ) This seem simple, but this is actually rather powerful! function create_function_multiplication(number) return function(x) return x * number; var doubled = numbers.map(create_function_multiplication(2)) 43 44
12 Closure in Python Python has limited support for closures: single statement: numbers.map(lambda v: v * 2) But support nested def create_function_multiplication(number): def function_addition(x): return x * number return function_addition doubled = numbers.map(create_function_multiplication(2)) Control 45 Control flow (1/2) In imperative programming, a control flow statement execution result in a choice between two paths Exemple: if, while... In functional programming, it is done using a special function. For instance, in Lisp: (COND (condition1 result1 ) (condition2 result2 )... (T resultn ) ) Control flow (2/2) The functional way in imperative languages: In JavaScript, C++, Java, Ruby...): condition? result1 : result2; In Python: condition if result1 else result
13 What about loops? Loop constructs is imperative How would you implement the equivalent of a loop in functional? function factorial(n) var r = 1; for(var i = 2; i <= n; ++i) r *= i; return r; Recursion 49 What is recursion? A function is called recursive if the body of that function calls itself, either directly or indirectly. Factorial: the classical example (1/2) Factorial in factorial :: Integral -> Integral factorial 0 = 1 factorial n = n * factorial (n-1) Factorial in Common LISP: (define (factorial n) (cond ((= n 0) 1) (t (* n (factorial (- n 1)))))) 51 52
14 Factorial: the classical example (1/2) Recursion vs loops With a loop: function factorial(n) var r = 1; for(var i = 2; i <= n; ++i) r *= i; return r; With a recursive function factorial(n) return (n===0)? 1 : n * factorial(n-1) while(expression) do_something(); function loop_something(args...) if(expression) return; else do_something(); loop_something(args...); (define (loop_something args...) (cond (expression) value) (t (do_something) (loop_something args...)) When to use recursion rather than iteration? (1/3) When to use recursion rather than iteration? (2/3) def factorial(n): if(n == 0): return 1 else: return n * factorial(n-1) factorial(10) -> factorial(1000) -> RuntimeError: maximum recursion depth exceeded in comparison In most programming language, the number of function call is limited by the size of the stack sys.getrecursionlimit() -> 1000 sys.setrecursionlimit(1003) factorial(1000) -> Tail-call optimisation Calling a function is usually more expensive than a loop 55 56
15 When to use recursion rather than iteration? (3/3) It is a matter of Recursion is a bit more general than loops When walking through a tree Advantages and inconvenient of functional programming 57 No side-effects pure functional In pure functional, calling a function only return a value The implication is that calling a function with the same arguments will always return the same value Is the withdraw function pure functional? (define balance 100) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) enter code Verification and proving To prove a program correct, must consider everything a program depends on In pure functional programs, depdence on any data structure is explicit 59 60
16 Proving properties in functional programming Proving properties in imperative programming (define (power b n) (cond ((= n 0) 1) (t (* (power b (- n 1)))))) Claim: for any integer n 0 and any number b, (power b n) = bⁿ Proof: 1) Verify the base case: (power b 2) Assume that (power b (- n 1)) is correct 3) Verify that (power b n) is correct assuming that (power b (- n 1)) is correct function power(b, n) int result = 1; for(int i = 0; i < n; + +i) result *= b; return result; Devise a loop invariant: (n i) (result = bⁱ) Prove that it is true for the first loop iteration Prove that each loop iteration preserves it Assume that (n i) (result = bⁱ) Prove that (n j) (result = bʲ) with j = i Concurency Concurency is one of the current hot topic in programming The main challenge is data-race Imperative programs are very sensible to data-race because of states There is no data-race in pure functional languages all data is immutable all functions are pure, without side-effects Summary on the upside of functional programming The main advantage is no sideeffects Verification and proving Concurency Productivity? Ericsson claims an increase in productivity between 9 and 25 times when using their home-grown version of Erlang 63 64
17 The downside of functional programming My Key message about programming paradigms In practice, there is very limited need for proving a program Mostly in critical applications: rocket control, hospital... And how do you prove hardware? Be pragmatic, there is no one answer! Performance issues (remember function call are expensive) Very limited support Most programming tasks require 65 66
Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction
Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction Introduction to the different Programming Paradigm The different programming paradigms Why different paradigms?
More informationLecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Cyrille Berger
Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction Concepts and models of programming languages The different programming paradigms Why different paradigms?
More informationList of lectures. Lecture content. Imperative Programming. TDDA69 Data and Program Structure Imperative Programming and Data Structures
List of lectures TDDA69 Data and Program Structure Imperative Programming and Data Structures Cyrille Berger 1Introduction and Functional Programming 2Imperative Programming and Data Structures 3Parsing
More information61A Lecture 2. Wednesday, September 4, 2013
61A Lecture 2 Wednesday, September 4, 2013 Names, Assignment, and User-Defined Functions (Demo) Types of Expressions Primitive expressions: 2 add 'hello' Number or Numeral Name String Call expressions:
More informationCS 360 Programming Languages Interpreters
CS 360 Programming Languages Interpreters Implementing PLs Most of the course is learning fundamental concepts for using and understanding PLs. Syntax vs. semantics vs. idioms. Powerful constructs like
More information61A Lecture 2. Friday, August 28, 2015
61A Lecture 2 Friday, August 28, 2015 Names, Assignment, and User-Defined Functions (Demo) Types of Expressions Primitive expressions: 2 add 'hello' Number or Numeral Name String Call expressions: max
More informationCS 314 Principles of Programming Languages
CS 314 Principles of Programming Languages Lecture 15: Review and Functional Programming Zheng (Eddy) Zhang Rutgers University March 19, 2018 Class Information Midterm exam forum open in Sakai. HW4 and
More informationProgramming Languages, Summary CSC419; Odelia Schwartz
Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design
More informationCSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)
CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and
More informationConcepts of Programming Languages
Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014
More informationCS 242. Fundamentals. Reading: See last slide
CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language
More informationCom S 541. Programming Languages I
Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR
More informationCSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018
CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures Dan Grossman Autumn 2018 Typical workflow concrete syntax (string) "(fn x => x + x) 4" Parsing Possible errors / warnings
More informationFunctional Programming Lecture 1: Introduction
Functional Programming Lecture 1: Introduction Viliam Lisý Artificial Intelligence Center Department of Computer Science FEE, Czech Technical University in Prague viliam.lisy@fel.cvut.cz Acknowledgements
More informationCSCI 3136 Principles of Programming Languages
CSCI 3136 Principles of Programming Languages Summer 2013 Faculty of Computer Science Dalhousie University 1 / 100 CSCI 3136 Principles of Programming Languages Summer 2013 Aminul Islam Faculty of Computer
More informationCS 314 Principles of Programming Languages
CS 314 Principles of Programming Languages Lecture 16: Functional Programming Zheng (Eddy Zhang Rutgers University April 2, 2018 Review: Computation Paradigms Functional: Composition of operations on data.
More informationParsing Scheme (+ (* 2 3) 1) * 1
Parsing Scheme + (+ (* 2 3) 1) * 1 2 3 Compiling Scheme frame + frame halt * 1 3 2 3 2 refer 1 apply * refer apply + Compiling Scheme make-return START make-test make-close make-assign make- pair? yes
More informationIntroduction. A. Bellaachia Page: 1
Introduction 1. Objectives... 2 2. Why are there so many programming languages?... 2 3. What makes a language successful?... 2 4. Programming Domains... 3 5. Language and Computer Architecture... 4 6.
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationSeminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh.
Scientific Computing Aachen, 6 Feb 2014 navid.abbaszadeh@rwth-aachen.de Overview Trends Introduction Paradigms, Data Structures, Syntax Compilation & Execution Concurrency Model Reference Types Performance
More informationSOFTWARE ARCHITECTURE 6. LISP
1 SOFTWARE ARCHITECTURE 6. LISP Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/ 2 Compiler vs Interpreter Compiler Translate programs into machine languages Compilers are
More informationPart (04) Introduction to Programming
Part (04) Introduction to Programming Dr. Ahmed M. ElShafee 1 Dr. Ahmed ElShafee, ACU : Summer 2014, Introduction to CS 1 EVOLUTION To write a program for a computer, we must use a computer language. A
More informationLecture 16: Static Semantics Overview 1
Lecture 16: Static Semantics Overview 1 Lexical analysis Produces tokens Detects & eliminates illegal tokens Parsing Produces trees Detects & eliminates ill-formed parse trees Static semantic analysis
More informationG Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University
G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing
More informationSemantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End
Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors
More informationProgrammiersprachen (Programming Languages)
2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html
More informationFunctional programming in LISP
Programming Languages Week 4 Functional programming in LISP College of Information Science and Engineering Ritsumeikan University review of part 3 enumeration of dictionaries you receive a sequence of
More informationList of lectures. Lecture content. Symbolic Programming. TDDA69 Data and Program Structure Symbolic and Logic Programming Cyrille Berger
List of lectures TDDA69 Data and Program Structure Symbolic and Logic Programming Cyrille Berger 1Introduction and Functional Programming 2Imperative Programming and Data Structures 3Parsing 4Evaluation
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts
More informationProgramming (Econometrics)
Programming (Econometrics) Lecture 1: Introduction Tommi Tervonen Econometric Institute, Erasmus University Rotterdam Course learning objectives After this course, you should be able to: Program econometrical
More informationIntroduction to Engineering Using Robotics Experiments. Dr. Yinong Chen
Introduction to Engineering Using Robotics Experiments Dr. Yinong Chen Outline Historical Perspective Programming Language Generations Programming Language Paradigms Imperative Programming Paradigm Writing
More informationStatic Semantics. Lecture 15. (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1
Static Semantics Lecture 15 (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1 Current Status Lexical analysis Produces tokens Detects & eliminates illegal tokens Parsing
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationA Brief Introduction to Common Lisp
A Brief Introduction to Common Lisp David Gu Schloer Consulting Group david_guru@gty.org.in A Brief History Originally specified in 1958, Lisp is the second-oldest highlevel programming language in widespread
More informationChapter 1. Fundamentals of Higher Order Programming
Chapter 1 Fundamentals of Higher Order Programming 1 The Elements of Programming Any powerful language features: so does Scheme primitive data procedures combinations abstraction We will see that Scheme
More informationSemester Review CSC 301
Semester Review CSC 301 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out: l l l l Imperative Languages l assignment and iteration
More informationFunctional Languages. Hwansoo Han
Functional Languages Hwansoo Han Historical Origins Imperative and functional models Alan Turing, Alonzo Church, Stephen Kleene, Emil Post, etc. ~1930s Different formalizations of the notion of an algorithm
More informationLECTURE 18. Control Flow
LECTURE 18 Control Flow CONTROL FLOW Sequencing: the execution of statements and evaluation of expressions is usually in the order in which they appear in a program text. Selection (or alternation): a
More informationCOP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher
COP4020 ming Languages Compilers and Interpreters Robert van Engelen & Chris Lacher Overview Common compiler and interpreter configurations Virtual machines Integrated development environments Compiler
More informationFunctional Programming. Pure Functional Programming
Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).
More informationThe role of semantic analysis in a compiler
Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors
More informationCOMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking
Agenda COMP 181 Type checking October 21, 2009 Next week OOPSLA: Object-oriented Programming Systems Languages and Applications One of the top PL conferences Monday (Oct 26 th ) In-class midterm Review
More information6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson
6.184 Lecture 4 Interpretation Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 1 Interpretation Parts of an interpreter Arithmetic calculator
More informationLECTURE 16. Functional Programming
LECTURE 16 Functional Programming WHAT IS FUNCTIONAL PROGRAMMING? Functional programming defines the outputs of a program as a mathematical function of the inputs. Functional programming is a declarative
More informationSKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)
SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.
More informationIntroduction to Functional Programming
Introduction to Functional Programming Xiao Jia xjia@cs.sjtu.edu.cn Summer 2013 Scheme Appeared in 1975 Designed by Guy L. Steele Gerald Jay Sussman Influenced by Lisp, ALGOL Influenced Common Lisp, Haskell,
More informationSeminar in Programming Languages
Seminar in Programming Languages Shuly Wintner Fall 2010-11 Course web site: http://cs.haifa.ac.il/~shuly/teaching/10/plseminar/ Course Goals Programming Language Concepts A language is a conceptual universe
More informationCSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona
1/37 CSc 372 Comparative Programming Languages 2 : Functional Programming Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/37 Programming Paradigms
More informationData Types. (with Examples In Haskell) COMP 524: Programming Languages Srinivas Krishnan March 22, 2011
Data Types (with Examples In Haskell) COMP 524: Programming Languages Srinivas Krishnan March 22, 2011 Based in part on slides and notes by Bjoern 1 Brandenburg, S. Olivier and A. Block. 1 Data Types Hardware-level:
More informationCSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures
CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures Dan Grossman Fall 2014 Hi! I m not Hal J I love this stuff and have taught
More informationBEAMJIT, a Maze of Twisty Little Traces
BEAMJIT, a Maze of Twisty Little Traces A walk-through of the prototype just-in-time (JIT) compiler for Erlang. Frej Drejhammar 130613 Who am I? Senior researcher at the Swedish Institute
More informationDesign Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8
Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Type Systems, Names and Binding CMSC 330 - Spring 2013 1 Topics Covered Thus Far! Programming languages Ruby OCaml! Syntax specification Regular expressions
More informationProgramming language design and analysis
Programming language design and analysis Introduction Marius Minea 25 September 2017 Why this course? Programming languages are fundamental and one of the oldest CS fields Language design is an important
More informationCS558 Programming Languages Winter 2018 Lecture 4a. Andrew Tolmach Portland State University
CS558 Programming Languages Winter 2018 Lecture 4a Andrew Tolmach Portland State University 1994-2018 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.
More informationOutline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current
PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY Dr. John Georgas, Northern Arizona University Copyright John Georgas All Rights Reserved Outline Current Programming languages Compiled and interpreted implementations
More informationFP Foundations, Scheme
FP Foundations, Scheme In Text: Chapter 15 1 Functional Programming -- Prelude We have been discussing imperative languages C/C++, Java, Fortran, Pascal etc. are imperative languages Imperative languages
More informationChapter 7:: Data Types. Mid-Term Test. Mid-Term Test (cont.) Administrative Notes
Chapter 7:: Data Types Programming Language Pragmatics Michael L. Scott Administrative Notes Mid-Term Test Thursday, July 27 2006 at 11:30am No lecture before or after the mid-term test You are responsible
More informationFinal-Term Papers Solved MCQS with Reference
Solved MCQ(S) From FinalTerm Papers BY Arslan Jan 14, 2018 V-U For Updated Files Visit Our Site : Www.VirtualUstaad.blogspot.com Updated. Final-Term Papers Solved MCQS with Reference 1. The syntax of PHP
More informationChapter 1. Preliminaries
Chapter 1 Preliminaries Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language
More informationLecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)
Lecture 09 Ada to Software Engineering Mr. Mubashir Ali Lecturer (Dept. of dr.mubashirali1@gmail.com 1 Summary of Previous Lecture 1. ALGOL 68 2. COBOL 60 3. PL/1 4. BASIC 5. Early Dynamic Languages 6.
More informationWhy are there so many programming languages?
Chapter 1 :: Introduction Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier 1 Chapter01_ Introduction_4e - Tue November 21, 2017 Introduction Why are there so many
More informationOrganization of Programming Languages CS3200/5200N. Lecture 11
Organization of Programming Languages CS3200/5200N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Functional vs. Imperative The design of the imperative languages
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 4a Andrew Tolmach Portland State University 1994-2016 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.
More informationComp 333: Concepts of Programming Languages Fall 2016
Comp 333: Concepts of Programming Languages Fall 2016 Instructor: Professor Schwartz History Syntax and Semantics Compilers Language Constructs Names, Binding, Scoping, Data Types Expressions, Control
More informationExtending Jython. with SIM, SPARQL and SQL
Extending Jython with SIM, SPARQL and SQL 1 Outline of topics Interesting features of Python and Jython Relational and semantic data models and query languages, triple stores, RDF Extending the Jython
More informationProgramming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen
Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems Tommi Tervonen Econometric Institute, Erasmus School of Economics Course learning objectives After this course, you
More informationOverview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++
Scripting 1 Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Rationale C++ isn't the best choice for all problems Complicated feature set, syntax Low-level,
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing
More informationFunctional Programming and Haskell
Functional Programming and Haskell Tim Dawborn University of Sydney, Australia School of Information Technologies Tim Dawborn Functional Programming and Haskell 1/22 What are Programming Paradigms? A programming
More informationCS101 Introduction to Programming Languages and Compilers
CS101 Introduction to Programming Languages and Compilers In this handout we ll examine different types of programming languages and take a brief look at compilers. We ll only hit the major highlights
More informationCSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking
CSE450 Translation of Programming Languages Lecture 11: Semantic Analysis: Types & Type Checking Structure Project 1 - of a Project 2 - Compiler Today! Project 3 - Source Language Lexical Analyzer Syntax
More informationFoundations. Yu Zhang. Acknowledgement: modified from Stanford CS242
Spring 2013 Foundations Yu Zhang Acknowledgement: modified from Stanford CS242 https://courseware.stanford.edu/pg/courses/317431/ Course web site: http://staff.ustc.edu.cn/~yuzhang/fpl Reading Concepts
More informationRecursion. What is Recursion? Simple Example. Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem
Recursion Repeatedly Reduce the Problem Into Smaller Problems to Solve the Big Problem What is Recursion? A problem is decomposed into smaller sub-problems, one or more of which are simpler versions of
More informationMIDTERM EXAM (Solutions)
MIDTERM EXAM (Solutions) Total Score: 100, Max. Score: 83, Min. Score: 26, Avg. Score: 57.3 1. (10 pts.) List all major categories of programming languages, outline their definitive characteristics and
More informationINTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10
INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/10 GOAL OF THIS COURSE 2/10 GOAL OF THIS COURSE Encourage you to become better programmers 2/10 GOAL OF THIS
More informationProgramming Paradigms and Languages Introduction. dr Robert Kowalczyk WMiI UŁ
Programming Paradigms and Languages Introduction dr Robert Kowalczyk WMiI UŁ What is a programming paradigm? A programming paradigm is a fundamental style of computer programming, a way of building the
More informationSD314 Outils pour le Big Data
Institut Supérieur de l Aéronautique et de l Espace SD314 Outils pour le Big Data Functional programming in Python Christophe Garion DISC ISAE Christophe Garion SD314 Outils pour le Big Data 1/ 35 License
More informationIntroduction to the course and basic programming concepts
Introduction to the course and basic programming concepts Lecture 1 of TDA 540 Object-Oriented Programming Jesper Cockx Fall 2018 Chalmers University of Technology Gothenburg University About the course
More informationINF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION. Instructors: Crista Lopes Copyright Instructors.
INF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION Instructors: Crista Lopes Copyright Instructors. Topics Recursion Higher-order functions Continuation-Passing Style Monads (take 1) Identity Monad Maybe
More informationFunctional Programming. Big Picture. Design of Programming Languages
Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics
More informationFunctional Programming Lecture 13: FP in the Real World
Functional Programming Lecture 13: FP in the Real World Viliam Lisý Artificial Intelligence Center Department of Computer Science FEE, Czech Technical University in Prague viliam.lisy@fel.cvut.cz 1 Mixed
More informationPrinciples of Compiler Construction ( )
Principles of Compiler Construction ( ) Dr Mayer Goldberg October 25, 2017 Contents 1 Course Objectives 1 2 Course Requirements 2 3 Detailed Syllabus 3 4 Computation of grade 6 5 References 6 Course number:
More informationTopics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited
CMSC 330: Organization of Programming Languages Type Systems, Names & Binding Topics Covered Thus Far Programming languages Syntax specification Regular expressions Context free grammars Implementation
More informationMore Lambda Calculus and Intro to Type Systems
More Lambda Calculus and Intro to Type Systems Plan Heavy Class Participation Thus, wake up! Lambda Calculus How is it related to real life? Encodings Fixed points Type Systems Overview Static, Dyamic
More informationProgramming Language Pragmatics
Chapter 10 :: Functional Languages Programming Language Pragmatics Michael L. Scott Historical Origins The imperative and functional models grew out of work undertaken Alan Turing, Alonzo Church, Stephen
More informationPrinciples of Compiler Construction ( )
Principles of Compiler Construction ( ) Dr Mayer Goldberg September 5, 2016 Contents 1 Course Objectives 1 2 Course Requirements 2 3 Detailed Syllabus 3 4 References 6 Course number: 201-1-2061 Mandatory
More informationWhat is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done
What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g., C++) to low-level assembly language that can be executed by hardware int a,
More informationAn Introduction to Scheme
An Introduction to Scheme Stéphane Ducasse stephane.ducasse@inria.fr http://stephane.ducasse.free.fr/ Stéphane Ducasse 1 Scheme Minimal Statically scoped Functional Imperative Stack manipulation Specification
More informationCSCC24 Functional Programming Scheme Part 2
CSCC24 Functional Programming Scheme Part 2 Carolyn MacLeod 1 winter 2012 1 Based on slides from Anya Tafliovich, and with many thanks to Gerald Penn and Prabhakar Ragde. 1 The Spirit of Lisp-like Languages
More informationA Brief Introduction to Scheme (I)
A Brief Introduction to Scheme (I) Philip W. L. Fong pwlfong@cs.uregina.ca Department of Computer Science University of Regina Regina, Saskatchewan, Canada Scheme Scheme I p.1/44 Scheme: Feature Set A
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationAnnouncements. My office hours are today in Gates 160 from 1PM-3PM. Programming Project 3 checkpoint due tomorrow night at 11:59PM.
IR Generation Announcements My office hours are today in Gates 160 from 1PM-3PM. Programming Project 3 checkpoint due tomorrow night at 11:59PM. This is a hard deadline and no late submissions will be
More informationDenotational Semantics. Domain Theory
Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning
More informationCSCI 2041: Advanced Language Processing
CSCI 2041: Advanced Language Processing Chris Kauffman Last Updated: Wed Nov 28 13:25:47 CST 2018 1 Logistics Reading OSM: Ch 17 The Debugger OSM: Ch 13 Lexer and Parser Generators (optional) Practical
More informationControl in Sequential Languages
CS 242 2012 Control in Sequential Languages Reading: Chapter 8, Sections 8.1 8.3 (only) Section 7.3 of The Haskell 98 Report, Exception Handling in the I/O Monad, http://www.haskell.org/onlinelibrary/io-13.html
More information