Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts

Size: px
Start display at page:

Download "Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts"

Transcription

1 Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements of a list for which a predicate holds fun f i l t e r [ ] = [ ] f i l t e r pred ( x : : xs ) = i f pred x then x : : f i l t e r pred xs e l s e f i l t e r pred xs ; 4 Developing a program that detects possible uses of functionals in Standard ML source code and converts them to their higher order equivalents Philipp Mayerhofer March 7, Structure 1. Introduction 2. Problem analysis 3. Design and implementation 4. Conclusion 2

2 Aim Program detects possible uses of the functionals map and filter in Standard ML source code and converts them to their higher order equivalents Example: Notation possible use of map is expressible by a function fun s q u a r e [ ] = [ ] s q u a r e ( x : : xs ) = ( x x ) : : s q u a r e xs higher order equivalent v a l s q u a r e = map ( fn x = x x ) 5 Motivation educational software engineering optimisation 6., if Definition 1 A function, denoted is h-expressible by a function, if. Definition 2 A function, denoted is a higher order equivalent of a function Definition 3 An expression if. 7 Notation Example fun i n c l [ ] = [ ] i n c l ( x : : xs ) = ( x + 1 ) : : i n c l xs ; x + 1 ) ; v a l i n c l 2 = map ( fn x = incl is expressible by map map (fn x => x + 1) incl incl is h-expressible by map higher order equivalent of incl. map map incl 8

3 Templates fun f... [ ]... = [ ] f... ( x : : xs )... = some o p e r a t i o n : : f xs Problems: more than one way of expressing same functionality fun f... l... = i f l = [ ] then [ ] e l s e some o p e r a t i o n : : f ( t l l ) need meta variables for some operation 11 Problematic language constructs Pattern matching fun f1 [ ] = [ ] f1 ( x : : xs ) = ( x + 1 ) : : f1 xs ; fun f2 l = case l of [ ] = ( x : : xs ) = [ ] ( x + 1 ) : : f2 xs ; ( Does n o t compile w i t h o u t warning ) fun f3 l = i f ( l = [ ] ) then [ ] e l s e l e t v a l ( x : : xs ) = l in ( x + 1 ) : : f3 xs end ; 12 Problem analysis 9 Determining expressibility cf. matching fingerprints (a) Original fingerprint (b) Skeletal image define templates for structure of functionals match functions to templates to determine expressibility 10

4 Problematic language constructs Pattern matching (cont.) Normal form: convert to set of conditions and assignments define two meta-functions constr returns the constructor tag of a given type field of a given type field n returns the Example: function on previous slide converted to fun f l = i f ( c o n s t r l = [ ] ) then [ ] e l s e l e t v a l x = f i e l d 1 l v a l xs = f i e l d 2 l in ( x + 1 ) : : f xs end ; 13 Problematic language constructs Multiple arguments tuples vs. curried arguments fun f1 ( [ ], ) = [ ] f1 ( x : : xs, n ) = ( x+n ) : : f1 ( xs, n ) ; fun f2 [ ] = [ ] f2 ( x : : xs ) n = ( x+n ) : : f2 xs n ; tuples = single entity that give effect of multiple arguments restrict templates to curried arguments 14 Problematic language constructs Infix operators i n f i x d i v i d e s ; fun x d i v i d e s y = ( y mod x ) = 0 ; syntactic sugar for functions with two arguments 6 d i v i d e s 3 in non infix form op can apply op d i v i d e s ( 6, 3 ) normal form converts infix to non infix form op 15 Design and implementation 16

5 Implementation approach Working subset approach: 1. choose subset of Standard ML 2. implement program for the subset 3. gradually extend the subset 19 Conclusion 20 Architecture Input Lexical analysis token stream Parsing abstract syntax tree Normalisation normalised syntax tree Unification Output 17 Architecture (cont.) Unification stage: develop generic unification package data types for first order language terms unification algorithm for the data types divide unification stage into 2 stages: normalised syntax tree Convert to a first order language first order language Unify with templates (function, replacement) pairs 18

6 Summary introduced notation expressibility, h-expressibility, higher order equivalence showed how to determine expressibility cf. matching fingerprints unification with templates normal forms for pattern matching, infix operators explained architecture and implementation approach working subset approach analysed achievements and further work 23 Additional slides 24 Achievements fun double l = i f l = [ ] then [ ] e l s e ( ( hd l ) 2 ) : : double ( t l l ) ; fun double l = map ( fn x = ( op ( ( x, 2 ) ) ) ) l ; working program for subset of SML notation generic unification package 21 Further work extend subset improve generic unification package syntax for templates fun f... l... = i f ( l = [ ] ) then [ ] e l s e EXPR : : f ( t l l ) 22

7 Unification algorithm does not occur in such that then 1: disagreement set of 2: if then 3: return 4: else if variable term 5: for all do 6: 7: 8: goto step 1 9: else 10: return not unifiable 25 Algorithm 1: /* is an input source file */ 2: parse 3: normalise 4: set of function definitions in 5: templates of map filter 6: for all do 7: for all do 8: if unifies with then 9: convert to its higher order equivalent Initial subset minimal features to express functionals includes constants + tuples conditional expressions (if... then... else) boolean expressions (andalso, orelse) 26 excludes pattern matching infix operators nested expressions (let... in... end) exceptions entire module language 27

Outline. A recursive function follows the structure of inductively-defined data.

Outline. A recursive function follows the structure of inductively-defined data. Outline A recursive function follows the structure of inductively-defined data. With lists as our example, we shall study 1. inductive definitions (to specify data) 2. recursive functions (to process data)

More information

Declarative Computation Model. Conditional. Case statement. Procedure values (2) Procedure values. Sequential declarative computation model

Declarative Computation Model. Conditional. Case statement. Procedure values (2) Procedure values. Sequential declarative computation model Declarative Computation Model Kernel language semantics revisited (VRH.4.5) From kernel to practical language (VRH.6) Exceptions (VRH.7) Carlos Varela RPI October 0, 009 Adapted with permission from: Seif

More information

Compiling Techniques

Compiling Techniques Lecture 7: Abstract Syntax 13 October 2015 Table of contents Syntax Tree 1 Syntax Tree Semantic Actions Examples Abstract Grammar 2 Internal Representation AST Builder 3 Visitor Processing Semantic Actions

More information

Interoperation for Lazy and Eager Evaluation

Interoperation for Lazy and Eager Evaluation Interoperation for Lazy and Eager Evaluation 1 Matthews & Findler New method of interoperation Type safety, observational equivalence & transparency Eager evaluation strategies Lazy vs. eager 2 Lambda

More information

Principles of Program Analysis: A Sampler of Approaches

Principles of Program Analysis: A Sampler of Approaches Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag

More information

CFLs and Regular Languages. CFLs and Regular Languages. CFLs and Regular Languages. Will show that all Regular Languages are CFLs. Union.

CFLs and Regular Languages. CFLs and Regular Languages. CFLs and Regular Languages. Will show that all Regular Languages are CFLs. Union. We can show that every RL is also a CFL Since a regular grammar is certainly context free. We can also show by only using Regular Expressions and Context Free Grammars That is what we will do in this half.

More information

Unification and occur check. The programming language Prolog

Unification and occur check. The programming language Prolog Resolution and Logic Programming Ground resolution Unification and occur check General Resolution Logic Programming SLD-resolution The programming language Prolog Syntax Arithmetic Lists Slide 1 Motivation

More information

CSC 4181Compiler Construction. Context-Free Grammars Using grammars in parsers. Parsing Process. Context-Free Grammar

CSC 4181Compiler Construction. Context-Free Grammars Using grammars in parsers. Parsing Process. Context-Free Grammar CSC 4181Compiler Construction Context-ree Grammars Using grammars in parsers CG 1 Parsing Process Call the scanner to get tokens Build a parse tree from the stream of tokens A parse tree shows the syntactic

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming

More information

6.001 Recitation 22: Streams

6.001 Recitation 22: Streams 6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris

More information

Notes on Inductive Sets and Induction

Notes on Inductive Sets and Induction Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................

More information

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

Nunchaku: Flexible Model Finding for Higher-Order Logic

Nunchaku: Flexible Model Finding for Higher-Order Logic Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku

More information

Propositional Logic: Part II - Syntax & Proofs 0-0

Propositional Logic: Part II - Syntax & Proofs 0-0 Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems

More information

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics Introduction Arnd Poetzsch-Heffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010 Arnd Poetzsch-Heffter ( Software Technology Group Fachbereich

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Extending the Lambda Calculus: An Eager Functional Language

Extending the Lambda Calculus: An Eager Functional Language Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm

More information

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Salil Vadhan October 2, 2012 Reading: Sipser, 2.1 (except Chomsky Normal Form). Algorithmic questions about regular

More information

THEORY OF COMPILATION

THEORY OF COMPILATION Lecture 04 Syntax analysis: top-down and bottom-up parsing THEORY OF COMPILATION EranYahav 1 You are here Compiler txt Source Lexical Analysis Syntax Analysis Parsing Semantic Analysis Inter. Rep. (IR)

More information

Thesis Title Second Line if Necessary

Thesis Title Second Line if Necessary Thesis Title Second Line if Necessary by Author Name A thesis submitted to the School of Computing in conformity with the requirements for the degree of Master of Science Queen s University Kingston, Ontario,

More information

Abstract parsing: static analysis of dynamically generated string output using LR-parsing technology

Abstract parsing: static analysis of dynamically generated string output using LR-parsing technology Abstract parsing: static analysis of dynamically generated string output using LR-parsing technology Kyung-Goo Doh 1, Hyunha Kim 1, David A. Schmidt 2 1. Hanyang University, Ansan, South Korea 2. Kansas

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t

More information

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van ngelen, Flora State University, 2007 Position of a Parser in the Compiler Model 2 Source Program Lexical Analyzer Lexical

More information

Maschinelle Sprachverarbeitung

Maschinelle Sprachverarbeitung Maschinelle Sprachverarbeitung Parsing with Probabilistic Context-Free Grammar Ulf Leser Content of this Lecture Phrase-Structure Parse Trees Probabilistic Context-Free Grammars Parsing with PCFG Other

More information

Maschinelle Sprachverarbeitung

Maschinelle Sprachverarbeitung Maschinelle Sprachverarbeitung Parsing with Probabilistic Context-Free Grammar Ulf Leser Content of this Lecture Phrase-Structure Parse Trees Probabilistic Context-Free Grammars Parsing with PCFG Other

More information

A uniform programming language for implementing XML standards

A uniform programming language for implementing XML standards A uniform programming language for implementing XML standards Pavel Labath 1, Joachim Niehren 2 1 Commenius University, Bratislava, Slovakia 2 Inria Lille, France Sofsem 2015 Motivation Different data

More information

Lambda Calculus! Gunnar Gotshalks! LC-1

Lambda Calculus! Gunnar Gotshalks! LC-1 Lambda Calculus! LC-1 λ Calculus History! Developed by Alonzo Church during mid 1930 s! One fundamental goal was to describe what can be computed.! Full definition of λ-calculus is equivalent in power

More information

Functional Big-step Semantics

Functional Big-step Semantics Functional Big-step Semantics FM talk, 11 Mar 2015 Magnus Myréen Books Big-step semantics are defined as inductively defined relation. Functions are better! me Context: CakeML verified compiler Old compiler:

More information

Formal Methods Lecture 8. (B. Pierce's slides for the book Types and Programming Languages )

Formal Methods Lecture 8. (B. Pierce's slides for the book Types and Programming Languages ) Formal Methods Lecture 8 (B. Pierce's slides for the book Types and Programming Languages ) Erasure and Typability Erasure We can transform terms in λ to terms of the untyped lambda-calculus simply by

More information

Programming Language Concepts, CS2104 Lecture 3

Programming Language Concepts, CS2104 Lecture 3 Programming Language Concepts, CS2104 Lecture 3 Statements, Kernel Language, Abstract Machine 31 Aug 2007 CS2104, Lecture 3 1 Reminder of last lecture Programming language definition: syntax, semantics

More information

Declarative Programming for Agent Applications

Declarative Programming for Agent Applications Noname manuscript No. (will be inserted by the editor) Declarative Programming for Agent Applications J.W. Lloyd K.S. Ng Received: date / Accepted: date Abstract This paper introduces the execution model

More information

CVO103: Programming Languages. Lecture 2 Inductive Definitions (2)

CVO103: Programming Languages. Lecture 2 Inductive Definitions (2) CVO103: Programming Languages Lecture 2 Inductive Definitions (2) Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 2 March 13, 2018 1 / 20 Contents More examples of inductive definitions natural

More information

Bottom-Up Syntax Analysis

Bottom-Up Syntax Analysis Bottom-Up Syntax Analysis Mooly Sagiv http://www.cs.tau.ac.il/~msagiv/courses/wcc13.html Textbook:Modern Compiler Design Chapter 2.2.5 (modified) 1 Pushdown automata Deterministic fficient Parsers Report

More information

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008 Order Sorted Algebra Daniel Găină Japan Advanced Institute of Science and Technology March 8, 2008 Introduction There are many examples where all items of one sort are necessarily also items of some other

More information

Foundations of Programming Languages and Software Engineering

Foundations of Programming Languages and Software Engineering Foundations of Programming Languages and Software Engineering Jan-Georg Smaus (Peter Thiemann) Universität Freiburg July 2011 Abstract Data Types Foundations of Programming Languages and Software Engineering

More information

A Functional Language for Hyperstreaming XSLT

A Functional Language for Hyperstreaming XSLT A Functional Language for Hyperstreaming XSLT Pavel Labath 1, Joachim Niehren 2 1 Commenius University, Bratislava, Slovakia 2 Inria Lille, France May 2013 Motivation some types of tree transformations

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.

More information

Introduction to (Logic and Functional) Programming

Introduction to (Logic and Functional) Programming Introduction to (Logic and Functional) Programming http://www.cse.iitd.ac.in/ sak/courses/ilfp/2011-12.index.html S. Arun-Kumar Department of Computer Science and Engineering I. I. T. Delhi, Hauz Khas,

More information

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

A Modular Rewriting Semantics for CML

A Modular Rewriting Semantics for CML A Modular Rewriting Semantics for CML Fabricio Chalub Barbosa do Rosário frosario@ic.uff.br 19 de março de 2004 0-0 Outline A closer look at MSOS Mapping MSOS to MRS Executing and model checking CML programs

More information

Lecture 4. Algebra. Section 1:. Signature, algebra in a signature. Isomorphisms, homomorphisms, congruences and quotient algebras.

Lecture 4. Algebra. Section 1:. Signature, algebra in a signature. Isomorphisms, homomorphisms, congruences and quotient algebras. V. Borschev and B. Partee, September 18, 2001 p. 1 Lecture 4. Algebra. Section 1:. Signature, algebra in a signature. Isomorphisms, homomorphisms, congruences and quotient algebras. CONTENTS 0. Why algebra?...1

More information

Syntax Analysis Part I

Syntax Analysis Part I 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2013 2 Position of a Parser in the Compiler Model Source Program Lexical Analyzer

More information

Syntax Analysis Part I

Syntax Analysis Part I 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2013 2 Position of a Parser in the Compiler Model Source Program Lexical Analyzer

More information

The Life Cycle of Grammarware. CWI Scientific Meeting Vadim Zaytsev, SWAT, CWI 2012

The Life Cycle of Grammarware. CWI Scientific Meeting Vadim Zaytsev, SWAT, CWI 2012 The Life Cycle of Grammarware CWI Scientific Meeting Vadim Zaytsev, SWAT, CWI 2012 Grammarware Software Languages Language: make all: test: make clean make build make test./converge.py master.bgf base/

More information

Designing and Evaluating Generic Ontologies

Designing and Evaluating Generic Ontologies Designing and Evaluating Generic Ontologies Michael Grüninger Department of Industrial Engineering University of Toronto gruninger@ie.utoronto.ca August 28, 2007 1 Introduction One of the many uses of

More information

Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9

Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9 Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9 Prof. Dr. Reinhard von Hanxleden Christian-Albrechts Universität Kiel Department of Computer Science Real-Time Systems and

More information

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308 University of Leicester SEMANTICS OF PROGRAMMING LANGUAGES Course Notes for MC 308 Dr. R. L. Crole Department of Mathematics and Computer Science Preface These notes are to accompany the module MC 308.

More information

The Complexity of First-Order Extensible Dependency Grammar

The Complexity of First-Order Extensible Dependency Grammar The Complexity of First-Order Extensible Dependency Grammar Ralph Debusmann Programming Systems Lab Universität des Saarlandes Postfach 15 11 50 66041 Saarbrücken, Germany rade@ps.uni-sb.de Abstract We

More information

Principles of Program Analysis: Control Flow Analysis

Principles of Program Analysis: Control Flow Analysis Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

Predicate Logic - Introduction

Predicate Logic - Introduction Outline Motivation Predicate Logic - Introduction Predicates & Functions Quantifiers, Coming to Terms with Formulas Quantifier Scope & Bound Variables Free Variables & Sentences c 2001 M. Lawford 1 Motivation:

More information

Lecture 12: Core State Machines II

Lecture 12: Core State Machines II Software Design, Modelling and Analysis in UML Lecture 12: Core State Machines II 2015-12-15 12 2015-12-15 main Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universität Freiburg, Germany

More information

Bringing machine learning & compositional semantics together: central concepts

Bringing machine learning & compositional semantics together: central concepts Bringing machine learning & compositional semantics together: central concepts https://githubcom/cgpotts/annualreview-complearning Chris Potts Stanford Linguistics CS 244U: Natural language understanding

More information

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning. 3: Logic Why logic? Logic about inference or argument Start from assumptions or axioms Make deductions according to rules of reasoning Logic 3-1 Why logic? (continued) If I don t buy a lottery ticket on

More information

The Formal Architecture of. Lexical-Functional Grammar. Ronald M. Kaplan and Mary Dalrymple

The Formal Architecture of. Lexical-Functional Grammar. Ronald M. Kaplan and Mary Dalrymple The Formal Architecture of Lexical-Functional Grammar Ronald M. Kaplan and Mary Dalrymple Xerox Palo Alto Research Center 1. Kaplan and Dalrymple, ESSLLI 1995, Barcelona Architectural Issues Representation:

More information

Lecture 11 Context-Free Languages

Lecture 11 Context-Free Languages Lecture 11 Context-Free Languages COT 4420 Theory of Computation Chapter 5 Context-Free Languages n { a b : n n { ww } 0} R Regular Languages a *b* ( a + b) * Example 1 G = ({S}, {a, b}, S, P) Derivations:

More information

An Introduction to Z3

An Introduction to Z3 An Introduction to Z3 Huixing Fang National Trusted Embedded Software Engineering Technology Research Center April 12, 2017 Outline 1 SMT 2 Z3 Huixing Fang (ECNU) An Introduction to Z3 April 12, 2017 2

More information

CSCI 1590 Intro to Computational Complexity

CSCI 1590 Intro to Computational Complexity CSCI 1590 Intro to Computational Complexity Formula Size John E. Savage Brown University March 5, 2008 John E. Savage (Brown University) CSCI 1590 Intro to Computational Complexity March 5, 2008 1 / 13

More information

Integer Clocks and Local Time Scales

Integer Clocks and Local Time Scales Integer Clocks and Local Time Scales Part I Part II Adrien Guatto ENS - PARKAS SYNCHRON 2014 Adrien Guatto (ENS - PARKAS) Integer Clocks and Local Time Scales SYNCHRON 2014 1 / 31 Part I Adrien Guatto

More information

Compiling Techniques

Compiling Techniques Lecture 6: 9 October 2015 Announcement New tutorial session: Friday 2pm check ct course webpage to find your allocated group Table of contents 1 2 Ambiguity s Bottom-Up Parser A bottom-up parser builds

More information

Syntactic Analysis. Top-Down Parsing

Syntactic Analysis. Top-Down Parsing Syntactic Analysis Top-Down Parsing Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in Compilers class at University of Southern California (USC) have explicit permission to make

More information

A DOP Model for LFG. Rens Bod and Ronald Kaplan. Kathrin Spreyer Data-Oriented Parsing, 14 June 2005

A DOP Model for LFG. Rens Bod and Ronald Kaplan. Kathrin Spreyer Data-Oriented Parsing, 14 June 2005 A DOP Model for LFG Rens Bod and Ronald Kaplan Kathrin Spreyer Data-Oriented Parsing, 14 June 2005 Lexical-Functional Grammar (LFG) Levels of linguistic knowledge represented formally differently (non-monostratal):

More information

Context-Free Grammars (and Languages) Lecture 7

Context-Free Grammars (and Languages) Lecture 7 Context-Free Grammars (and Languages) Lecture 7 1 Today Beyond regular expressions: Context-Free Grammars (CFGs) What is a CFG? What is the language associated with a CFG? Creating CFGs. Reasoning about

More information

CSCI 490 problem set 6

CSCI 490 problem set 6 CSCI 490 problem set 6 Due Tuesday, March 1 Revision 1: compiled Tuesday 23 rd February, 2016 at 21:21 Rubric For full credit, your solutions should demonstrate a proficient understanding of the following

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

Chapter 2: Basic Notions of Predicate Logic

Chapter 2: Basic Notions of Predicate Logic 2. Basic Notions of Predicate Logic 2-1 Deductive Databases and Logic Programming (Winter 2009/2010) Chapter 2: Basic Notions of Predicate Logic Signature, Formula Interpretation, Model Implication, Consistency,

More information

Theorem Proving beyond Deduction

Theorem Proving beyond Deduction Theorem Proving beyond Deduction Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität

More information

Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl)

Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl) Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl) Leran Cai, Ambrus Kaposi, and Thorsten Altenkirch University of Nottingham {psylc5, psxak8, psztxa}@nottingham.ac.uk

More information

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,

More information

Lectures on The Lambda Calculus (I)

Lectures on The Lambda Calculus (I) Lectures on The Lambda Calculus (I) Masahiko Sato Graduate School of Informatics, Kyoto University Autumn school Proof and Computation Fischbachau, Germany October 4, 2016 Overview In these lectures, I

More information

Parsing -3. A View During TD Parsing

Parsing -3. A View During TD Parsing Parsing -3 Deterministic table-driven parsing techniques Pictorial view of TD and BU parsing BU (shift-reduce) Parsing Handle, viable prefix, items, closures, goto s LR(k): SLR(1), LR(1) Problems with

More information

Introduction to ANTLR (ANother Tool for Language Recognition)

Introduction to ANTLR (ANother Tool for Language Recognition) Introduction to ANTLR (ANother Tool for Language Recognition) Jon Eyolfson University of Waterloo September 27 - October 1, 2010 Outline Introduction Usage Example Demonstration Conclusion Jon Eyolfson

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Rigorous Software Development CSCI-GA

Rigorous Software Development CSCI-GA Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 2 Alloy Analyzer Analyzes micro models of software Helps to identify key properties of a software design find

More information

Meta-programming & you

Meta-programming & you Meta-programming & you Robin Message Cambridge Programming Research Group 10 th May 2010 What s meta-programming about? 1 result=somedb. customers. select 2 { first_name+ +last_name } 3 where name LIKE

More information

Safety Analysis versus Type Inference

Safety Analysis versus Type Inference Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus

More information

Movement-Generalized Minimalist Grammars

Movement-Generalized Minimalist Grammars Movet-Generalized Minimalist Grammars Thomas Graf tgraf@ucla.edu tgraf.bol.ucla.edu University of California, Los Angeles LACL 2012 July 2, 2012 Outline 1 Monadic Second-Order Logic (MSO) Talking About

More information

Context-Free Grammars and Languages. We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs.

Context-Free Grammars and Languages. We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs. Context-Free Grammars and Languages We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs. Contex-Free Languages (CFL s) played a central role natural languages

More information

TALP at GeoQuery 2007: Linguistic and Geographical Analysis for Query Parsing

TALP at GeoQuery 2007: Linguistic and Geographical Analysis for Query Parsing TALP at GeoQuery 2007: Linguistic and Geographical Analysis for Query Parsing Daniel Ferrés and Horacio Rodríguez TALP Research Center Software Department Universitat Politècnica de Catalunya {dferres,horacio}@lsi.upc.edu

More information

Parsing Beyond Context-Free Grammars: Tree Adjoining Grammars

Parsing Beyond Context-Free Grammars: Tree Adjoining Grammars Parsing Beyond Context-Free Grammars: Tree Adjoining Grammars Laura Kallmeyer & Tatiana Bladier Heinrich-Heine-Universität Düsseldorf Sommersemester 2018 Kallmeyer, Bladier SS 2018 Parsing Beyond CFG:

More information

Representing structured relational data in Euclidean vector spaces. Tony Plate

Representing structured relational data in Euclidean vector spaces. Tony Plate Representing structured relational data in Euclidean vector spaces Tony Plate tplate@acm.org http://www.d-reps.org October 2004 AAAI Symposium 2004 1 Overview A general method for representing structured

More information

COSE312: Compilers. Lecture 2 Lexical Analysis (1)

COSE312: Compilers. Lecture 2 Lexical Analysis (1) COSE312: Compilers Lecture 2 Lexical Analysis (1) Hakjoo Oh 2017 Spring Hakjoo Oh COSE312 2017 Spring, Lecture 2 March 12, 2017 1 / 15 Lexical Analysis ex) Given a C program float match0 (char *s) /* find

More information

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 11/20/2013 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-Logic Languages

An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-Logic Languages Università degli Studi di Udine Dipartimento di Matematica e Informatica Dottorato di Ricerca in Informatica Ph.D. Thesis An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-Logic

More information

Higher Order Containers

Higher Order Containers Higher Order Containers Thorsten Altenkirch 1, Paul Levy 2, and Sam Staton 3 1 University of Nottingham 2 University of Birmingham 3 University of Cambridge Abstract. Containers are a semantic way to talk

More information

First-Order Logic. Chapter Overview Syntax

First-Order Logic. Chapter Overview Syntax Chapter 10 First-Order Logic 10.1 Overview First-Order Logic is the calculus one usually has in mind when using the word logic. It is expressive enough for all of mathematics, except for those concepts

More information

Annotation tasks and solutions in CLARIN-PL

Annotation tasks and solutions in CLARIN-PL Annotation tasks and solutions in CLARIN-PL Marcin Oleksy, Ewa Rudnicka Wrocław University of Technology marcin.oleksy@pwr.edu.pl ewa.rudnicka@pwr.edu.pl CLARIN ERIC Common Language Resources and Technology

More information

Compiling Techniques

Compiling Techniques Lecture 3: Introduction to 22 September 2017 Reminder Action Create an account and subscribe to the course on piazza. Coursework Starts this afternoon (14.10-16.00) Coursework description is updated regularly;

More information

Limitations of OCAML records

Limitations of OCAML records Limitations of OCAML records The record types must be declared before they are used; a label e can belong to only one record type (otherwise fun x x.e) would have several incompatible types; we cannot

More information

Data Analysis 1 INTRODUCTION

Data Analysis 1 INTRODUCTION Data Analysis 1 INTRODUCTION 1 Introduction Todays ERP systems like Microsoft Dynamics AX and Navision use multi purpose programming languages and/or SQL queries to express reports, where reporting essentially

More information

Well Founded Relations and Recursion

Well Founded Relations and Recursion Well Founded Relations and Recursion Roger Bishop Jones Abstract Fixed points, well founded relations and a recursion theorem. http://www.rbjones.com/rbjpub/pp/doc/t005.pdf Created 2004/07/15 Last Modified

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

Notes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.

Notes from Yesterday s  Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons. CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch

More information

CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing

CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing CMSC 330: Organization of Programming Languages Pushdown Automata Parsing Chomsky Hierarchy Categorization of various languages and grammars Each is strictly more restrictive than the previous First described

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between

More information

Syntax Directed Transla1on

Syntax Directed Transla1on Syntax Directed Transla1on Syntax Directed Transla1on CMPT 379: Compilers Instructor: Anoop Sarkar anoopsarkar.github.io/compilers-class Syntax directed Translation Models for translation from parse trees

More information

Mixing Finite Success and Finite Failure. Automated Prover

Mixing Finite Success and Finite Failure. Automated Prover in an Automated Prover Alwen Tiu 1, Gopalan Nadathur 2 and Dale Miller 3 1 INRIA Lorraine, France 2 University of Minnesota, USA 3 INRIA Futurs/École polytechnique, France ESHOL 2005 Montego Bay, Jamaica

More information

INF5110 Compiler Construction

INF5110 Compiler Construction INF5110 Compiler Construction Parsing Spring 2016 1 / 84 Overview First and Follow set: general concepts for grammars textbook looks at one parsing technique (top-down) [Louden, 1997, Chap. 4] before studying

More information

Depending on equations

Depending on equations Depending on equations A proof-relevant framework for unification in dependent type theory Jesper Cockx DistriNet KU Leuven 3 September 2017 Unification for dependent types Unification is used for many

More information

A Deterministic Logical Semantics for Esterel

A Deterministic Logical Semantics for Esterel SOS 2004 Preliminary Version A Deterministic Logical Semantics for Esterel Olivier Tardieu 1 NRA Sophia Antipolis, France Abstract Esterel is a synchronous design language for the specification of reactive

More information

CONTEXT FREE GRAMMAR AND

CONTEXT FREE GRAMMAR AND CONTEXT FREE GRAMMAR AND PARSING STATIC ANALYSIS - PARSING Source language Scanner (lexical analysis) tokens Parser (syntax analysis) Syntatic structure Semantic Analysis (IC generator) Syntatic/sema ntic

More information