On Compilation and Call-by-Value Games. Ulrich Schöpp LMU Munich
|
|
- Mae Cameron
- 6 years ago
- Views:
Transcription
1 On Compilation and Call-by-Value Games Ulrich Schöpp LMU Munich
2 Motivation Understand low-level decompositions of high-level languages. let rec fib x = if x < 1 then 1 else (fib (x - 1)) + (fib (x - 2))... %x6 = phi i32 [ 38, %case1 ], [ %unpack35, %case145 ], [ %add, %case167 ] %add = add i32 %x6, -1 %eq47 = icmp ne i32 %add, 0 switch i1 %eq47, label %case049 [ i1 true, label %case148 ]... Example: Defunctionalisation
3 Motivation Example: Defunctionalisation successful in practical applications surprisingly few theoretical results Need better understanding for: formal verification compositional reasoning resource usage analysis and certification modularity
4 Compilation and Games 1. Low-Level Language 2. Review: Idealized Algol 3. Call-by-Value PCF 4. Call-by-Value Games
5 Low-Level Programs The target is a first-order low-level language. first-order data tail recursion (cf. SSA-form compiler intermediate languages) Example: Factorial fun fac(n) = let f = 1 in loop(n, f) fun loop(n, f) = if n = 0 then ret(f) else body(n, f) fun body(n, f) = let f' = n * f in let n' = n - 1 in loop(n', f')
6 Control Flow Graph int fun fac(n) = let f = 1 in loop(n, f) int int fun loop(n, f) = if n = 0 then ret(f) else body(n, f) int int int int int fun body(n, f) = let f' = n * f in let n' = n - 1 in loop(n', f')
7 Low-Level Code Fragments int int int int int int int int
8 Low-Level Code Fragments int int int int int int int int
9 Low-Level Code Fragments int int int int int int int int int
10 Low-Level Code Fragments int int int int int int int
11 Game Semantics for Compilation Idea: Construct a game semantic model from low-level programs. Interpretation becomes compilation. Developed for compilation to... abstract machines [Mackie] hardware circuits [Ghica, Smith, Singh] logspace Turing Machines [Dal Lago, S.] π-calculus [Honda, Yoshida, Berger] quantum circuits [Hoshino, Hasuo, Yoshimizu, Faggian, Dal Lago]...
12 Game Semantics for Compilation Idea: Construct a game semantic model from low-level programs. Interpretation becomes compilation. Much work focussed on: Algol-like language (call-by-name) Low-Level Language Abramsky-Jagadeesan-Malacaria games Geometry of Interaction
13 Algol-Like Language Types A, B ::= α unit int A B X, Y ::= exp(a) exp(a, B) X Y X Y!X α. X α. X Translation by interpretation in a GoI-style model. A closed term t: X translates to a low-level fragment: X t X +
14 Algol-Like Language Types: A, B ::= α unit int A B µα. A X, Y ::= exp(a) exp(a, B) X Y X Y!X α. X α. X... Translation by interpretation in a GoI-style model. t: exp(a) unit t A
15 Algol-Like Language Types: A, B ::= α unit int A B µα. A X, Y ::= exp(a) exp(a, B) X Y X Y!X α. X α. X... Translation by interpretation in a GoI-style model. t: exp(a) t: exp(b, A) unit t A B t A
16 Algol-Like Language t: X Y Y X + t Y + X
17 Algol-Like Language t: X Y t s: Y Y X + t Y + X Y t Y + s
18 Algol-Like Language t: X Y t s: Y Y X + t Y + X Y t Y + s t:!x N X t N X +
19 Algol-Like Language t: X Y t s: Y Y X + t Y + X Y t Y + s t:!x t: α. X N X t N X + X [N/α] t X + [N/α]
20 Algol-Like Languages Games offer a simple approach to compiling Algol-like languages. efficient implementation possible resource control close to existing compilation techniques Algol-like languages (call-by-name) t: β. exp(β) exp(β int, int) Low-Level Language
21 Call-by-Value Are games good for the compilation of call-by-value languages? Call-by-Value PCF Low-Level Language
22 Call-by-Value Games? The efficient implementation of call-by-value plays by low-level programs is not immediate. (N N) 5 6 (N N) N How should function values be stored? How long do they need to be stored?
23 What do Compilers implement? Call-by-Value PCF Low-Level Language Common idea: For each term, generate code to evaluate the term s value. For abstractions: generate code for the function body. Assemble code fragments suitably.
24 What do Compilers implement? Example let a = 2 in let b = a + 3 in let f = fun x a * x + b in let g = if a < b then f else fun x x + 3 in print (g 5)
25 What do Compilers implement? Example let a = 2 in let b = a + 3 in let f =... in let g = if a < b then f else... in print (apply(g, 5)) fun apply(g, x) =... fun apply1(..., x) = a * x + b fun apply2(..., x) = x + 3
26 What do Compilers implement? Closures let a = 2 in let b = a + 3 in let f = {addr = &apply1; vars = (a, b)} in let g = if a < b then f else {addr = &apply2; vars = ()} in print (apply(g, 5)) fun apply(c, x) = c.addr(c.vars, x) fun apply1((a, b), x) = a * x + b fun apply2((), x) = x + 3
27 What do Compilers implement? Defunctionalisation let a = 2 in let b = a + 3 in let f = (a, b) in let g = if a < b then Left(f) else Right() in print (apply(g, 5)) fun apply(g, x) = case g of Left(f) apply1(f, x) Right() apply2((), x) fun apply1((a, b), x) = a * x + b fun apply2((), x) = x + 3
28 Capture such Translations Compositionally Can we capture such translations compositionally? formal verification resource usage analysis and certification modularity Study formalisations of the general approach: For each term, generate code to evaluate the term s value. For each term, generate code needed to make use of its value (e.g. function application). Assemble code fragments suitably.
29 Typed Closure Conversion Call-by-Value PCF t: X Typed Closure Conversion Algol-like Language t : α. exp(c X α ) I X α Low-Level Language
30 Typed Closure Conversion Idea: Translate a PCF v term t: X to a term of type α.!exp(c X α ) I X α
31 Typed Closure Conversion Idea: Translate a PCF v term t: X to a term of type α.!exp(c X α ) I X α Base type C N α = int I N α = I α.!exp(c N α ) I N α =!exp(int)
32 Typed Closure Conversion Idea: Translate a PCF v term t: X to a term of type α.!exp(c X α ) I X α Function types C X Y α := α I X Y α := β. I X β γ.!exp(α C X β, C Y γ ) I Y γ Example: α.!exp(c N N α ) I N N α = α.!exp(α)!exp(α int, int)
33 Typed Closure Conversion Idea: Translate a PCF v term t: X to a term of type α.!exp(c X α ) I X α Terms A PCF v term x 1 :X 1,..., x k :X k t: Y translates to a term of type α 1... α k. I X 1 α1... I X k αk M Y C X1 α C X k α where M Y A := β.!exp(a, C Y β ) I Y β.
34 Translation Application app Γ s: X Y t: X Γ, s t: Y where s t := Λ α β. λ x. λ y. let pack(α s, e s, i s ) = s α x in let pack(α t, e t, i t ) = t β y in let pack(ρ, apply, i ) = i s α t i t in pack(ρ, e, i ) e := fn ( x, y) let v s = e s ( x) in let v t = e t ( y) in apply(v s, v t )
35 Translation Application app Γ s: X Y t: X Γ, s t: Y where s t := Λ α β. λ x. λ y. let pack(α s, e s, i s ) = s α x in let pack(α t, e t, i t ) = t β y in let pack(ρ, apply, i ) = i s α t i t in pack(ρ, e, i ) e := fn ( x, y) let v s = e s ( x) in let v t = e t ( y) in t apply(v s, v t ) s
36 Translation Abstraction Γ, x:x t: Y abs Γ fn x t: X Y fn x t := Λ α. λ x. pack(c Γ α, fn c return c, Λβ. λx:i X β. t α β x x )
37 Case Distinction Case distinction tags function values like defunctionalisation. Example if t: B s 1 : N N s 2 : N N if t then s 1 else s 2 : N N Up to isomorphism: t :!exp(bool) s 1 : α.!exp(α)!exp(α int, int) s 2 : β.!exp(β)!exp(β int, int) =!exp(α + β)!exp((α + β) int, int) = γ.!exp(γ)!exp(γ int, int)
38 What does the Translation implement? With a suitable Algol-like language, one obtains a variant of defunctionalisation. Example let a = 2 in let b = a + 3 in let f = fun x a * x + b in let g = if a < b then f else fun x x + 3 in print (g 5)
39 What does the Translation implement? Example let a = 2 in let b = a + 3 in let f = (a, b) in let g = if a < b then Left(f) else Right() in case g of Left(f) apply1(f, x) Right() apply2((), x) fun apply1((a, b), x) = h(a * x + b) fun apply2((), x) = h(x + 3) fun h(x) = print(x); return
40 Implementation A suitable Algol-like language is developed in [S. 2016]. PCF t: X Algol-like language t : α A. (S exp(c X α )) I X α Low-Level Language Assembly Language xorl %eax, %eax popq %rdx
41 Call-by-Value Games In which order can values appear in low-level program traces? M X = α.!exp(c X α ) I X α : n, N unit n, x N C X A I X A
42 Call-by-Value Games In which order can values appear in low-level program traces? I N A : empty I X Y A : n, f, x N (A C X B ) n, y N C Y D I X B I Y D
43 Call-by-Value Games Compare to arenas in Honda-Yoshida games: M(X): x C(X) I(N) : empty I(X Y ) : x C(X) y C(Y ) I(X) I(X) I(Y ) C(N) = N C(X Y ) = { }
44 Call-by-Value Games (N N) (N N) N
45 Call-by-Value Games (N N) (N N) N i, f i, f j, f, g j, g, f, 5 j, g, 6 j, g, 7 j, 8 j, 8
46 Call-by-Value Games (N N) (N N) N i, f i, f j, f, g j, g, f, 5 j, g, 6 j, g, 7 j, 8 j, 8
47 Call-by-Value Games Abramsky and McCusker s construction of call-by-value games from Hyland-Ong games. Model types by families of games, e.g. {1 n n N} for N. Map from {X i i I} to T {Y j j J} is a strict strategy i I!X i q i I strict j J!Y j q j J!X i!y j Compare: ( α.!exp(c X α ) I X α ) strict ( β.!exp(c Y β ) I Y β )
48 Conclusion Study call-by-value games as a theory of compiled machine code! Directions Establish precise connections for various translations. defunctionalisation heap-allocated closures Apply results from game semantics to real machine code. verification specification resource analysis (length of plays as an approximation of program run-time)
Calculus INT. Value Types A, B ::= types of the low-level language Interactive Types X, Y ::= [A] A X X Y A X
Calculus INT Calculus INT Value Types A, B ::= types of the low-level language Interactive Types X, Y ::= [A] A X X Y A X X Y α A. X α A. X Related: Call-by-Push-Value [Levy 2004] Enrichted Effect Calculus
More informationCompositional Software Model Checking
Compositional Software Model Checking Dan R. Ghica Oxford University Computing Laboratory October 18, 2002 Outline of talk program verification issues the semantic challenge programming languages the logical
More informationDefinability and full abstraction in lambda-calculi
Definability and full abstraction in lambda-calculi Antonio Bucciarelli Laboratoire Preuves, Programmes et Systèmes Université Paris Diderot Outline 1 Introduction 2 The full abstraction problem for PCF
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 information1.3. Conditional expressions To express case distinctions like
Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a
More informationGame Semantics: an Overview
Game Semantics: an Overview Guy McCusker Game Semantics: an Overview p.1/45 What did he say? Qu est-ce ue c est la sémantiue des jeux? Or in English... Game Semantics: an Overview p.2/45 What did he say?
More informationEnsuring Secure Non-interference of Programs by Game Semantics
Ensuring Secure Non-interference of Programs by Game Semantics Aleksandar S. Dimovski IT University of Copenhagen, 2300 Copenhagen S, Denmark adim@itu.dk Abstract. Non-interference is a security property
More informationHigher-Order Logic. Specification and Verification with Higher-Order Logic
Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern
More informationContinuation Passing Style. Continuation Passing Style
161 162 Agenda functional programming recap problem: regular expression matcher continuation passing style (CPS) movie regular expression matcher based on CPS correctness proof, verification change of
More informationModules Matter Most. Robert Harper Carnegie Mellon University. MacQueen Fest Chicago May 2012
Modules Matter Most Robert Harper Carnegie Mellon University MacQueen Fest Chicago May 2012 Thanks... to the organizers for organizing this meeting.... to Dave for being an inspiration to and influence
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 informationLambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,
Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety
More informationProgramming Languages and Compilers (CS 421)
Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC http://courses.engr.illinois.edu/cs421 Based in part on slides by Mattox Beckman, as updated by Vikram Adve and Gul Agha 9/18/17
More informationScope, Functions, and Storage Management
Scope, Functions, and Storage Management Implementing Functions and Blocks cs3723 1 Simplified Machine Model (Compare To List Abstract Machine) Registers Code Data Program Counter (current instruction)
More informationn What is its running time? 9/18/17 2 n poor_rev [1,2,3] = n (poor_rev [1] = n ((poor_rev [1] =
Recall Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC http://courses.engr.illinois.edu/cs421 Based in part on slides by Mattox Beckman, as updated by Vikram Adve and Gul Agha
More informationHECTOR: An Equivalence Checker for a Higher-Order Fragment of ML
HECTOR: An Equivalence Checker for a Higher-Order Fragment of ML David Hopkins 1 Andrzej S. Murawski 2 C.-H. Luke Ong 1 1 Department of Computer Science, University of Oxford, UK 2 Department of Computer
More informationCS 4110 Programming Languages & Logics. Lecture 28 Recursive Types
CS 4110 Programming Languages & Logics Lecture 28 Recursive Types 7 November 2014 Announcements 2 Foster office hours 11-12pm Guest lecture by Fran on Monday Recursive Types 3 Many languages support recursive
More informationLambda Calculus. Variables and Functions. cs3723 1
Lambda Calculus Variables and Functions cs3723 1 Lambda Calculus Mathematical system for functions Computation with functions Captures essence of variable binding Function parameters and substitution Can
More informationChapter 2 The Language PCF
Chapter 2 The Language PCF We will illustrate the various styles of semantics of programming languages with an example: the language PCF Programming language for computable functions, also called Mini-ML.
More information3.7 Denotational Semantics
3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These
More informationFunctional programming languages
Functional programming languages Part V: functional intermediate representations Xavier Leroy INRIA Paris-Rocquencourt MPRI 2-4, 2015 2017 X. Leroy (INRIA) Functional programming languages MPRI 2-4, 2015
More informationHigher-Order Intensional Type Analysis. Stephanie Weirich Cornell University
Higher-Order Intensional Type Analysis Stephanie Weirich Cornell University Reflection A style of programming that supports the run-time discovery of program information. What does this code do? How is
More informationFunctional Concepts in C++
Trends in Functional Programming 2006 Nottingham Functional Concepts in C++ Rose H. Abdul Rauf, Anton Setzer, Ulrich Berger Swansea 1 Goal: Integrating Functional and Object-Oriented Programming A first
More informationComp 311: Sample Midterm Examination
Comp 311: Sample Midterm Examination October 29, 2007 Name: Id #: Instructions 1. The examination is closed book. If you forget the name for a Scheme operation, make up a name for it and write a brief
More informationCompilers: The goal. Safe. e : ASM
Compilers: The goal What s our goal with compilers? Take a high level language, turn it into a low level language In a semantics preserving way. e : ML Safe e : ASM 1 Compilers: The goal What s our goal
More informationLecture slides & distribution files:
Type Theory Lecture slides & distribution files: http://www.cs.rhul.ac.uk/home/zhaohui/ttlectures.html Zhaohui Luo Department of Computer Science Royal Holloway, University of London April 2011 2 Type
More informationRecursive Definitions, Fixed Points and the Combinator
Recursive Definitions, Fixed Points and the Combinator Dr. Greg Lavender Department of Computer Sciences University of Texas at Austin Recursive Self-Reference Recursive self-reference occurs regularly
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER 2012 2013 MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS Time allowed TWO hours Candidates may complete the front
More informationVerification of Higher-Order Computation: A Game-Semantic Approach
Verification of Higher-Order Computation: A Game-Semantic Approach C.-H. L. Ong Oxford University Computing Laboratory users.comlab.ox.ac.uk/luke.ong/ Abstract. We survey recent developments in an approach
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 informationFunctional Programming and λ Calculus. Amey Karkare Dept of CSE, IIT Kanpur
Functional Programming and λ Calculus Amey Karkare Dept of CSE, IIT Kanpur 0 Software Development Challenges Growing size and complexity of modern computer programs Complicated architectures Massively
More informationOverview. A normal-order language. Strictness. Recursion. Infinite data structures. Direct denotational semantics. Transition semantics
Overview A normal-order language Strictness Recursion Infinite data structures Direct denotational semantics Transition semantics Lazy (call-by-need) evaluation and its semantics A Normal-Order Language
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 informationIntroduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming
Introduction to ML Mooly Sagiv Cornell CS 3110 Data Structures and Functional Programming Typed Lambda Calculus Chapter 9 Benjamin Pierce Types and Programming Languages Call-by-value Operational Semantics
More informationProgramming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine.
CMSC 330: Organization of Programming Languages Lambda Calculus Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying or tuples
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying
More informationLambda Calculus. Concepts in Programming Languages Recitation 6:
Concepts in Programming Languages Recitation 6: Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming
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 informationMPRI course 2-4 Functional programming languages Exercises
MPRI course 2-4 Functional programming languages Exercises Xavier Leroy October 13, 2016 Part I: Interpreters and operational semantics Exercise I.1 (**) Prove theorem 2 (the unique decomposition theorem).
More informationParsers. Xiaokang Qiu Purdue University. August 31, 2018 ECE 468
Parsers Xiaokang Qiu Purdue University ECE 468 August 31, 2018 What is a parser A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure
More informationGame Semantics, Open Systems and Components
Game Semantics, Open Systems and Components Samson Abramsky The Game Plan Overview of work in game semantics, including some recent developments. Applied and algorithmic aspects. Some tentative thoughts
More informationVariables and Bindings
Net: Variables Variables and Bindings Q: How to use variables in ML? Q: How to assign to a variable? # let = 2+2;; val : int = 4 let = e;; Bind the value of epression e to the variable Variables and Bindings
More informationWednesday, September 9, 15. Parsers
Parsers What is a parser A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda
More informationParsers. What is a parser. Languages. Agenda. Terminology. Languages. A parser has two jobs:
What is a parser Parsers A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda
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 informationCOMP80 Lambda Calculus Programming Languages Slides Courtesy of Prof. Sam Guyer Tufts University Computer Science History Big ideas Examples:
COMP80 Programming Languages Slides Courtesy of Prof. Sam Guyer Lambda Calculus Formal system with three parts Notation for functions Proof system for equations Calculation rules called reduction Idea:
More informationA Revisionist History of Denotational Semantics
A Revisionist History of Denotational Semantics Stephen Brookes Carnegie Mellon University Domains XIII July 2018 1 / 23 Denotational Semantics Compositionality Principle The meaning of a complex expression
More informationThe Low-Level Bounded Model Checker LLBMC
The Low-Level Bounded Model Checker LLBMC A Precise Memory Model for LLBMC Carsten Sinz Stephan Falke Florian Merz October 7, 2010 VERIFICATION MEETS ALGORITHM ENGINEERING KIT University of the State of
More informationCombining Static and Dynamic Contract Checking for Curry
Michael Hanus (CAU Kiel) Combining Static and Dynamic Contract Checking for Curry LOPSTR 2017 1 Combining Static and Dynamic Contract Checking for Curry Michael Hanus University of Kiel Programming Languages
More informationCS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our
More informationMinCaml: A Simple and Efficient Compiler for a Minimal Functional Language. Eijiro Sumii Tohoku University
MinCaml: A Simple and Efficient Compiler for a Minimal Functional Language Eijiro Sumii Tohoku University Highlights "Simple and efficient compiler for a minimal functional language" Only 2000 lines of
More informationLecture 13 CIS 341: COMPILERS
Lecture 13 CIS 341: COMPILERS Announcements HW4: OAT v. 1.0 Parsing & basic code generation Due: March 28 th START EARLY! Midterm Exam Grades Available on Gradescope Zdancewic CIS 341: Compilers 2 Midterm
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More informationA Quick Overview. CAS 701 Class Presentation 18 November Department of Computing & Software McMaster University. Church s Lambda Calculus
A Quick Overview CAS 701 Class Presentation 18 November 2008 Lambda Department of Computing & Software McMaster University 1.1 Outline 1 2 3 Lambda 4 5 6 7 Type Problem Lambda 1.2 Lambda calculus is a
More informationCompiling conventional languages to unconventional architectures
Compiling conventional languages to unconventional architectures an R. Ghica! joint work with Alex Smith and Olle Fredriksson OASIS 10th 24 November 2014 1 with or without game semantics Compiling conventional
More informationλ-calculus Lecture 1 Venanzio Capretta MGS Nottingham
λ-calculus Lecture 1 Venanzio Capretta MGS 2018 - Nottingham Table of contents 1. History of λ-calculus 2. Definition of λ-calculus 3. Data Structures 1 History of λ-calculus Hilbert s Program David Hilbert
More informationContinuations and Continuation-Passing Style
Continuations and Continuation-Passing Style Lecture 4 CS 390 1/16/08 Goal Weʼre interested in understanding how to represent the state of a co-routine Insight into what a thread really means How fundamental
More informationWednesday, August 31, Parsers
Parsers How do we combine tokens? Combine tokens ( words in a language) to form programs ( sentences in a language) Not all combinations of tokens are correct programs (not all sentences are grammatically
More informationData-Abstraction Refinement: A Game Semantic Approach
Data-Abstraction Refinement: A Game Semantic Approach Aleksandar Dimovski 1,DanR.Ghica 2, and Ranko Lazić 1 1 Department of Computer Science, Univ. of Warwick, Coventry, CV4 7AL, UK 2 School of Computer
More informationChapter 11 :: Functional Languages
Chapter 11 :: Functional Languages Programming Language Pragmatics Michael L. Scott Copyright 2016 Elsevier 1 Chapter11_Functional_Languages_4e - Tue November 21, 2017 Historical Origins The imperative
More informationA Partial Correctness Proof for Programs with Decided Specifications
Applied Mathematics & Information Sciences 1(2)(2007), 195-202 An International Journal c 2007 Dixie W Publishing Corporation, U. S. A. A Partial Correctness Proof for Programs with Decided Specifications
More informationSymbolic Computation and Common Lisp
Symbolic Computation and Common Lisp Dr. Neil T. Dantam CSCI-56, Colorado School of Mines Fall 28 Dantam (Mines CSCI-56) Lisp Fall 28 / 92 Why? Symbolic Computing: Much of this course deals with processing
More informationProcesses as Types: A Generic Framework of Behavioral Type Systems for Concurrent Processes
Processes as Types: A Generic Framework of Behavioral Type Systems for Concurrent Processes Atsushi Igarashi (Kyoto Univ.) based on joint work [POPL2001, TCS2003] with Naoki Kobayashi (Tohoku Univ.) Programming
More informationMobile Resource Guarantees
Mobile Resource Guarantees Ian Stark Laboratory for Foundations of Computer Science School of Informatics, University of Edburgh David Aspall, Stephen Gilmore, Don Sannella, *Kenneth MacKenzie, *Lennart
More informationCHAPTER ONE OVERVIEW. 1.1 Continuation-passing style
CHAPTER ONE OVERVIEW ML is a strict higher-order functional programming language with statically checked polymorphic types, garbage collection, and a complete formally defined semantics. Standard ML of
More informationType Checking and Type Inference
Type Checking and Type Inference Principles of Programming Languages CSE 307 1 Types in Programming Languages 2 Static Type Checking 3 Polymorphic Type Inference Version: 1.8 17:20:56 2014/08/25 Compiled
More informationMonday, September 13, Parsers
Parsers Agenda Terminology LL(1) Parsers Overview of LR Parsing Terminology Grammar G = (Vt, Vn, S, P) Vt is the set of terminals Vn is the set of non-terminals S is the start symbol P is the set of productions
More informationRecursive Functions. 6.1 Primitive Recursive Functions
6 Recursive Functions The intuitive notion of an effectively computable function is the notion of a function for which there are definite, explicit rules, following which one could in principle compute
More informationHutton, Graham and Bahr, Patrick (2016) Cutting out continuations. In: WadlerFest, April 2016, Edinburgh, Scotland.
Hutton, Graham and Bahr, Patrick (2016) Cutting out continuations. In: WadlerFest, 11-12 April 2016, Edinburgh, Scotland. Access from the University of Nottingham repository: http://eprints.nottingham.ac.uk/32703/1/cutting.pdf
More informationIntroduction to lambda calculus Part 3
Introduction to lambda calculus Part 3 Antti-Juhani Kaijanaho 2017-01-27... 1 Untyped lambda calculus... 2 Typed lambda calculi In an untyped lambda calculus extended with integers, it is required that
More informationCSE-321 Programming Languages 2012 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score
More informationTypical workflow. CSE341: Programming Languages. Lecture 17 Implementing Languages Including Closures. Reality more complicated
Typical workflow concrete synta (string) "(fn => + ) 4" Parsing CSE341: Programming Languages abstract synta (tree) Lecture 17 Implementing Languages Including Closures Function Constant + 4 Var Var Type
More informationSemantics of programming languages
Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming
More informationCSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.
CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:
More informationChapter 15. Functional Programming Languages
Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 Summer 2017 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of
More informationWhere is ML type inference headed?
1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 Turing Completeness Turing machines are the most powerful description of computation possible They define the Turing-computable functions
More informationLambda Calculus. Lambda Calculus
Lambda Calculus Formalism to describe semantics of operations in functional PLs Variables are free or bound Function definition vs function abstraction Substitution rules for evaluating functions Normal
More informationSpeed: Precise and Efficient Static Estimation of Program Computational Complexity
Speed: Precise and Efficient Static Estimation of Program Computational Complexity Sumit Gulwani Krishna K. Mehra Trishul Chilimbi POPL 2009 Presented by Stefan Blumer Motivation Performance Bugs Motivation
More informationSemantics of programming languages
Semantics of programming languages Informatics 2A: Lecture 27 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 18 November, 2014 1 / 18 Two parallel pipelines A large proportion
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of Moving Bodies 2 Prioritätsstreit,
More informationCOMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein
COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion
More informationAn experiment with variable binding, denotational semantics, and logical relations in Coq. Adam Chlipala University of California, Berkeley
A Certified TypePreserving Compiler from Lambda Calculus to Assembly Language An experiment with variable binding, denotational semantics, and logical relations in Coq Adam Chlipala University of California,
More informationThe Safe λ-calculus. William Blum. Joint work with C.-H. Luke Ong. BCTCS, 2 5 April Oxford University Computing Laboratory
The Safe λ-calculus William Blum Joint work with C.-H. Luke Ong Oxford University Computing Laboratory BCTCS, 2 5 April 2007 Overview Safety: a restriction for higher-order grammars. Transposed to the
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More informationCPS 506 Comparative Programming Languages. Programming Language Paradigm
CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming
More informationHoare logic. A proof system for separation logic. Introduction. Separation logic
Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.
More informationWriting code that I'm not smart enough to write. A funny thing happened at Lambda Jam
Writing code that I'm not smart enough to write A funny thing happened at Lambda Jam Background "Let s make a lambda calculator" Rúnar Bjarnason Task: write an interpreter for the lambda calculus Lambda
More informationProgramming with Types
Programming with Types Run-time type analysis and the foundations of program reflection Stephanie Weirich Cornell University Reflection A style of programming that supports the run-time discovery of program
More informationClosures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming
Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming t ::= x x. t t t Call-by-value big-step Operational Semantics terms variable v ::= values abstraction x.
More informationHOMER: A Higher-Order Observational Equivalence Model checker
HOMER: A Higher-Order Observational Equivalence Model checker David Hopkins and C.-H. Luke Ong Oxford University Computing Laboratory Abstract. We present HOMER, an observational-equivalence model checker
More information9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati Why study? Lambda calculus Syntax Evaluation Relationship to programming languages Church Rosser theorem Completeness of Lambda Calculus: Turing
More informationApplying Game Semantics to Compositional Software Modeling and Verification
Applying Game Semantics to Compositional Software Modeling and Verification Samson Abramsky, Dan R. Ghica, Andrzej S. Murawski, and C.-H. Luke Ong Oxford University Computing Laboratory Parks Road, Oxford,
More informationF-ing Applicative Functors
F-ing Applicative Functors Andreas Rossberg, Google Claudio Russo, MSR Derek Dreyer, MPI-SWS ML Workshop, Copenhagen 2012/09/13 The Functor Schism The Functor Schism SML: generative functors return fresh
More informationBegin at the beginning
Begin at the beginning Expressions (Syntax) Exec-time Dynamic Values (Semantics) Compile-time Static Types 1. Programmer enters expression 2. ML checks if expression is well-typed Using a precise set of
More informationTail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d)
CMSC 330: Organization of Programming Languages Tail Calls A tail call is a function call that is the last thing a function does before it returns let add x y = x + y let f z = add z z (* tail call *)
More informationInteraction Nets vs. the ρ-calculus: Introducing Bigraphical Nets
Interaction Nets vs. the ρ-calculus: Introducing Bigraphical Nets Maribel Fernández 1 Ian Mackie 1 François-Régis Sinot 2 1 DCS, King s College London 2 LIX, École Polytechnique Rho-Calculus Workshop,
More informationLLVM and IR Construction
LLVM and IR Construction Fabian Ritter based on slides by Christoph Mallon and Johannes Doerfert http://compilers.cs.uni-saarland.de Compiler Design Lab Saarland University 1 Project Progress source code
More informationFunctional Programming
Functional Programming CS331 Chapter 14 Functional Programming Original functional language is LISP LISt Processing The list is the fundamental data structure Developed by John McCarthy in the 60 s Used
More information