# Contents. Chapter 1 SPECIFYING SYNTAX 1

Size: px
Start display at page:

Download "Contents. Chapter 1 SPECIFYING SYNTAX 1"

Transcription

1 Contents Chapter 1 SPECIFYING SYNTAX GRAMMARS AND BNF 2 Context-Free Grammars 4 Context-Sensitive Grammars 8 Exercises THE PROGRAMMING LANGUAGE WREN 10 Ambiguity 12 Context Constraints in Wren 13 Semantic Errors in Wren 15 Exercises VARIANTS OF BNF 18 Exercises ABSTRACT SYNTAX 21 Abstract Syntax Trees 21 Abstract Syntax of a Programming Language 23 Exercises FURTHER READING 30 Chapter 2 INTRODUCTION TO LABORATORY ACTIVITIES SCANNING 33 Exercises LOGIC GRAMMARS 40 Motivating Logic Grammars 41 Improving the Parser 44 Prolog Grammar Rules 46 Parameters in Grammars 47 Executing Goals in a Logic Grammar 49 Exercises PARSING WREN 50 Handling Left Recursion 52 Left Factoring 55 Exercises FURTHER READING 57 Chapter 3 ATTRIBUTE GRAMMARS CONCEPTS AND EXAMPLES 59 Examples of Attribute Grammars 60 Formal Definitions 66 xi

2 xii CONTENTS Semantics via Attribute Grammars 67 Exercises AN ATTRIBUTE GRAMMAR FOR WREN 74 The Symbol Table 74 Commands 80 Expressions 82 Exercises LABORATORY: CONTEXT CHECKING WREN 92 Declarations 96 Commands 99 Expressions 101 Exercises FURTHER READING 103 Chapter 4 TWO-LEVEL GRAMMARS CONCEPTS AND EXAMPLES 105 Fortran String Literals 111 Derivation Trees 113 Exercises A TWO-LEVEL GRAMMAR FOR WREN 116 Declarations 117 Commands and Expressions 124 Exercises TWO-LEVEL GRAMMARS AND PROLOG 132 Implementing Two-Level Grammars in Prolog 133 Two-Level Grammars and Logic Programming 136 Exercises FURTHER READING 138 Chapter 5 THE LAMBDA CALCULUS CONCEPTS AND EXAMPLES 140 Syntax of the Lambda Calculus 140 Curried Functions 143 Semantics of Lambda Expressions 145 Exercises LAMBDA REDUCTION 147 Reduction Strategies 151 Correlation with Parameter Passing 155 Constants in the Pure Lambda Calculus 156 Functional Programming Languages 158 Exercises LABORATORY: A LAMBDA CALCULUS EVALUATOR 160 Scanner and Parser 160 The Lambda Calculus Evaluator 162 Exercises 165

3 CONTENTS xiii 5.4 FURTHER READING 166 Chapter 6 SELF-DEFINITION OF PROGRAMMING LANGUAGES SELF-DEFINITION OF LISP 167 Metacircular Interpreter 169 Running the Interpreter 174 Exercises SELF-DEFINITION OF PROLOG 179 Displaying Failure 181 Exercises FURTHER READING 185 Chapter 7 TRANSLATIONAL SEMANTICS CONCEPTS AND EXAMPLES 187 A Program Translation 189 Exercises ATTRIBUTE GRAMMAR CODE GENERATION 191 Expressions 193 Commands 201 Exercises LABORATORY: IMPLEMENTING CODE GENERATION 215 Commands 217 Expressions 219 Exercises FURTHER READING 222 Chapter 8 TRADITIONAL OPERATIONAL SEMANTICS CONCEPTS AND EXAMPLES 224 VDL 226 Exercises SECD: AN ABSTRACT MACHINE 228 Example 231 Parameter Passing 232 Static Scoping 233 Exercises LABORATORY: IMPLEMENTING THE SECD MACHINE 235 Exercises STRUCTURAL OPERATIONAL SEMANTICS: INTRODUCTION 238 Specifying Syntax 239 Inference Systems and Structural Induction 242 Exercises STRUCTURAL OPERATIONAL SEMANTICS: EXPRESSIONS 245 Semantics of Expressions in Wren 245

4 xiv CONTENTS Example 248 Outcomes 250 Exercises STRUCTURAL OPERATIONAL SEMANTICS: COMMANDS 253 A Sample Computation 256 Semantic Equivalence 260 Natural Semantics 261 Exercises LABORATORY: IMPLEMENTING STRUCTURAL OPERATIONAL SEMANTICS 264 Commands 265 Expressions 267 Top-Level Driver 268 Exercises FURTHER READING 269 Chapter 9 DENOTATIONAL SEMANTICS CONCEPTS AND EXAMPLES 271 The Syntactic World 272 The Semantic World 273 Compositionality 276 Exercises A CALCULATOR LANGUAGE 277 Calculator Semantics 280 Semantic Functions 282 A Sample Calculation 283 Exercises THE DENOTATIONAL SEMANTICS OF WREN 285 Semantic Domains 286 Language Constructs in Wren 288 Auxiliary Functions 290 Semantic Equations 290 Error Handling 293 Semantic Equivalence 294 Input and Output 294 Elaborating a Denotational Definition 296 Exercises LABORATORY: IMPLEMENTING DENOTATIONAL SEMANTICS 304 Exercises DENOTATIONAL SEMANTICS WITH ENVIRONMENTS 310 Environments 311 Stores 312 Semantic Functions 313 Semantic Equations 316 Procedures 318 Exercises 321

5 CONTENTS xv 9.6 CHECKING CONTEXT-SENSITIVE SYNTAX 323 Exercises CONTINUATION SEMANTICS 328 Continuations 331 The Programming Language Gull 333 Auxiliary Functions 335 Semantic Equations 336 The Error Continuation 336 Exercises FURTHER READING 339 Chapter 10 DOMAIN THEORY AND FIXED-POINT SEMANTICS CONCEPTS AND EXAMPLES 341 Recursive Definitions of Functions 342 Recursive Definitions of Sets (Types) 343 Modeling Nontermination 344 Exercises DOMAIN THEORY 345 Elementary Domains 348 Product Domains 349 Sum Domains (Disjoint Unions) 351 Function Domains 355 Continuity of Functions on Domains 361 Exercises FIXED-POINT SEMANTICS 365 First Step 366 Second Step 368 Continuous Functionals 374 Fixed points for Nonrecursive Functions 379 Revisiting Denotational Semantics 380 Fixed-Point Induction 382 Exercises LABORATORY: RECURSION IN THE LAMBDA CALCULUS 388 Conditional Expressions 390 Paradoxical Combinator 390 Fixed-Point Identity 392 Exercises FURTHER READING 394 Chapter 11 AXIOMATIC SEMANTICS CONCEPTS AND EXAMPLES 395 Axiomatic Semantics of Programming Languages AXIOMATIC SEMANTICS FOR WREN 398 Assignment Command 398 Input and Output 400

6 xvi CONTENTS Rules of Inference 401 While Command and Loop Invariants 405 More on Loop Invariants 408 Nested While Loops 410 Exercises AXIOMATIC SEMANTICS FOR PELICAN 418 Blocks 420 Nonrecursive Procedures 422 Recursive Procedures 425 Exercises PROVING TERMINATION 432 Steps in Showing Termination 433 Termination of Recursive Procedures 435 Exercises INTRODUCTION TO PROGRAM DERIVATION 437 Table of Cubes 437 Binary Search 440 Exercises FURTHER READING 442 Chapter 12 ALGEBRAIC SEMANTICS CONCEPTS AND EXAMPLES 444 A Module for Truth Values 446 Module Syntax 447 A Module for Natural Numbers 448 A Module for Characters 452 A Parameterized Module and Some Instantiations 453 A Module for Finite Mappings 456 Exercises MATHEMATICAL FOUNDATIONS 460 Ground Terms 461 Σ-Algebras 461 A Congruence from the Equations 463 The Quotient Algebra 465 Homomorphisms 466 Consistency and Completeness 467 Exercises USING ALGEBRAIC SPECIfiCATIONS 471 Data Abstraction 471 A Module for Unbounded Queues 472 Implementing Queues as Unbounded Arrays 474 Verification of Queue Axioms 477 ADTs As Algebras 477 Abstract Syntax and Algebraic Specifications 481 Exercise 485

7 CONTENTS xvii 12.4 ALGEBRAIC SEMANTICS FOR WREN 487 Types and Values in Wren 488 Abstract Syntax for Wren 489 A Type Checker for Wren 490 An Interpreter for Wren 494 A Wren System 498 Exercises LABORATORY: IMPLEMENTING ALGEBRAIC SEMANTICS 499 Module Booleans 500 Module Naturals 501 Declarations 503 Commands 503 Expressions 505 Exercises FURTHER READING 506 Chapter 13 ACTION SEMANTICS CONCEPTS AND EXAMPLES 508 Data and Sorts 511 Yielders 514 Actions 515 The Functional Facet 515 The Imperative Facet 518 Exercises ACTION SEMANTICS OF A CALCULATOR 522 Semantic Functions 523 Semantic Equations 524 A Sample Calculation 528 Exercises THE DECLARATIVE FACET AND WREN 531 The Programming Language Wren 534 Exercises THE REFLECTIVE FACET AND PELICAN 541 The Reflective Facet and Procedures 545 Procedures Without Parameters 547 Procedures With A Parameter 548 Recursive Definitions 550 Translating to Action Notation 551 Exercises LABORATORY: TRANSLATING INTO ACTION NOTATION 559 Exercises FURTHER READING 563

8 xviii CONTENTS Appendix A LOGIC PROGRAMMING WITH PROLOG 565 Prolog 566 BNF Syntax for Prolog 568 A Prolog Example 569 Predefined Predicates 571 Recursion in Prolog 572 Control Aspects of Prolog 574 Lists in Prolog 575 Sorting in Prolog 581 The Logical Variable 582 Equality and Comparison in Prolog 583 Input and Output Predicates 585 Appendix B FUNCTIONAL PROGRAMMING WITH SCHEME 587 Lisp 588 Scheme Syntax 589 Functions on S-expressions 590 Lists in Scheme 591 Syntax for Functions 592 Scheme Evaluation 593 Special Forms 596 Defining Functions in Scheme 596 Recursive Definitions 598 Lambda Notation 599 Recursive Functions on Lists 599 Scope Rules in Scheme 603 Proving Correctness in Scheme 605 Higher-Order Functions 606 Currying 608 Tail Recursion 609 Bibliography 611 Index 625

### The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation

### Index. Symbols. --> 47 :: 107 ::= 3 E[v E 1 ] 145 [ ] See emphatic brackets ε 18 λ * 149 5, 148 * 148

Index INDEX 625 Symbols --> 47 :: 107 ::= 3 E[v E 1 ] 145 [ ] See emphatic brackets 346 356 ε 18 λ 140 18 18 345 149 * 149 5, 148 * 148 α 148 β 148 δ 150 η 149 262 246 260 A abstract data types 443, 471

### LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

### Programming Languages Third Edition

Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

### Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

### Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer

Torben./Egidius Mogensen Introduction to Compiler Design ^ Springer Contents 1 Lexical Analysis 1 1.1 Regular Expressions 2 1.1.1 Shorthands 4 1.1.2 Examples 5 1.2 Nondeterministic Finite Automata 6 1.3

### 1. 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

### Chapter 3. Describing Syntax and Semantics

Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

### Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors

### Formal Systems and their Applications

Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

### Introductory logic and sets for Computer scientists

Introductory logic and sets for Computer scientists Nimal Nissanke University of Reading ADDISON WESLEY LONGMAN Harlow, England II Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario

### Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings

### Chapter 3. Describing Syntax and Semantics ISBN

Chapter 3 Describing Syntax and Semantics ISBN 0-321-49362-1 Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the

### Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

There is no single widely acceptable notation or formalism for describing semantics Operational Describe the meaning of a program by executing its statements on a machine, either simulated or actual. The

### Chapter 3. Describing Syntax and Semantics

Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

### COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

COSC252: Programming Languages: Semantic Specification Jeremy Bolton, PhD Adjunct Professor Outline I. What happens after syntactic analysis (parsing)? II. Attribute Grammars: bridging the gap III. Semantic

### The formal methods discussed in earlier chapters, particularly

Chapter 13 ACTION SEMANTICS The formal methods discussed in earlier chapters, particularly denotational semantics and structural operational semantics, have been used extensively to provide accurate and

### Chapter 3. Syntax - the form or structure of the expressions, statements, and program units

Syntax - the form or structure of the expressions, statements, and program units Semantics - the meaning of the expressions, statements, and program units Who must use language definitions? 1. Other language

### CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End

### COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER. lg Cambridge UNIVERSITY PRESS

COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER lg Cambridge UNIVERSITY PRESS ^0 Contents Foreword page ix Preface xiii 1 Formal Study of Natural Language 1 1.1 The

### MIDTERM EXAMINATION. CSE 130: Principles of Programming Languages. Professor Goguen. February 16, points total

CSE 130, Winter 2006 MIDTERM EXAMINATION CSE 130: Principles of Programming Languages Professor Goguen February 16, 2006 100 points total Don t start the exam until you are told to. Turn off any cell phone

### R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

R13 SET - 1 III B. Tech I Semester Regular Examinations, November - 2015 1 a) What constitutes a programming environment? [3M] b) What mixed-mode assignments are allowed in C and Java? [4M] c) What is

### Chapter 3. Describing Syntax and Semantics ISBN

Chapter 3 Describing Syntax and Semantics ISBN 0-321-49362-1 Chapter 3 Topics Describing the Meanings of Programs: Dynamic Semantics Copyright 2015 Pearson. All rights reserved. 2 Semantics There is no

### INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Name : PRINCIPLES OF PROGRAMMING LANGUAGES Code : A40511 Class : II B. Tech

### EXTENSIONS OF FIRST ORDER LOGIC

EXTENSIONS OF FIRST ORDER LOGIC Maria Manzano University of Barcelona CAMBRIDGE UNIVERSITY PRESS Table of contents PREFACE xv CHAPTER I: STANDARD SECOND ORDER LOGIC. 1 1.- Introduction. 1 1.1. General

### An Annotated Language

Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of

### About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

Table of Contents About the Authors... iii Introduction... xvii Chapter 1: System Software... 1 1.1 Concept of System Software... 2 Types of Software Programs... 2 Software Programs and the Computing Machine...

### Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Natural Semantics Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 1 Natural deduction is an instance of first-order logic; that is, it is the formal

### CMSC 330: Organization of Programming Languages. Operational Semantics

CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged

### This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

### Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors

### St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-00 014 Subject: PPL Class : CSE III 1 P a g e DEPARTMENT COMPUTER SCIENCE AND ENGINEERING S No QUESTION Blooms Course taxonomy level Outcomes UNIT-I

### Com 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

### CS 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

### Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 1 Tuesday, January 29, 2013 1 Intro to semantics What is the meaning of a program? When we write a program, we use

### SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA

Contents i SYLLABUS UNIT - I CHAPTER - 1 : INTRODUCTION Programs Related to Compilers. Translation Process, Major Data Structures, Other Issues in Compiler Structure, Boot Strapping and Porting. CHAPTER

### CSCC24 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

### Foundations. 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

### Boolean Reasoning. The Logic of Boolean Equations. Frank Markham Brown Air Force Institute of Technology

Boolean Reasoning The Logic of Boolean Equations by Frank Markham Brown Air Force Institute of Technology ff Kluwer Academic Publishers Boston/Dordrecht/London Contents Preface Two Logical Languages Boolean

### List of Figures. About the Authors. Acknowledgments

List of Figures Preface About the Authors Acknowledgments xiii xvii xxiii xxv 1 Compilation 1 1.1 Compilers..................................... 1 1.1.1 Programming Languages......................... 1

### Chapter 3: Syntax and Semantics. Syntax and Semantics. Syntax Definitions. Matt Evett Dept. Computer Science Eastern Michigan University 1999

Chapter 3: Syntax and Semantics Matt Evett Dept. Computer Science Eastern Michigan University 1999 Syntax and Semantics Syntax - the form or structure of the expressions, statements, and program units

### Functional programming with Common Lisp

Functional programming with Common Lisp Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada August 11, 2016 1 / 81 Expressions and functions

### Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

### Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)

### Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

Informal Semantics of Data semantic specification names (identifiers) attributes binding declarations scope rules visibility 1 Ways to Specify Semantics Standards Documents (Language Definition) Language

### MATHEMATICAL STRUCTURES FOR COMPUTER SCIENCE

MATHEMATICAL STRUCTURES FOR COMPUTER SCIENCE A Modern Approach to Discrete Mathematics SIXTH EDITION Judith L. Gersting University of Hawaii at Hilo W. H. Freeman and Company New York Preface Note to the

### 3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

### Syntax/semantics. Program <> program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing

Syntax/semantics Program program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing Meta-models 8/27/10 1 Program program execution Syntax Semantics

### Introduction to Scheme

How do you describe them Introduction to Scheme Gul Agha CS 421 Fall 2006 A language is described by specifying its syntax and semantics Syntax: The rules for writing programs. We will use Context Free

### CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

By the end of this course, students should CIS 1.5 Course Objectives a. Understand the concept of a program (i.e., a computer following a series of instructions) b. Understand the concept of a variable

### DISCRETE MATHEMATICS

DISCRETE MATHEMATICS WITH APPLICATIONS THIRD EDITION SUSANNA S. EPP DePaul University THOIVISON * BROOKS/COLE Australia Canada Mexico Singapore Spain United Kingdom United States CONTENTS Chapter 1 The

### Computing Fundamentals 2 Introduction to CafeOBJ

Computing Fundamentals 2 Introduction to CafeOBJ Lecturer: Patrick Browne Lecture Room: K408 Lab Room: A308 Based on work by: Nakamura Masaki, João Pascoal Faria, Prof. Heinrich Hußmann. See notes on slides

### MIDTERM 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

### COP4020 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

### Programming 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

### Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massachusetts, 2000 Among the many approaches to formal reasoning

### CLASSIC DATA STRUCTURES IN JAVA

CLASSIC DATA STRUCTURES IN JAVA Timothy Budd Oregon State University Boston San Francisco New York London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal CONTENTS

### A CRASH COURSE IN SEMANTICS

LAST TIME Recdef More induction NICTA Advanced Course Well founded orders Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 Well founded recursion Calculations: also/finally {P}... {Q}

### Theoretical Part. Chapter one:- - What are the Phases of compiler? Answer:

Theoretical Part Chapter one:- - What are the Phases of compiler? Six phases Scanner Parser Semantic Analyzer Source code optimizer Code generator Target Code Optimizer Three auxiliary components Literal

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

### Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics Meeting 10, CSCI 5535, Spring 2009 Announcements Homework 3 due tonight Homework 2 is graded 13 (mean), 14 (median), out of 21 total, but Graduate class: final project

### The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

Semantics The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. The semantics of a programming language assigns a precise

### Defining Languages GMU

Defining Languages CS463 @ GMU How do we discuss languages? We might focus on these qualities: readability: how well does a language explicitly and clearly describe its purpose? writability: how expressive

### 7. Introduction to Denotational Semantics. Oscar Nierstrasz

7. Introduction to Denotational Semantics Oscar Nierstrasz Roadmap > Syntax and Semantics > Semantics of Expressions > Semantics of Assignment > Other Issues References > D. A. Schmidt, Denotational Semantics,

### Application: Programming Language Semantics

Chapter 8 Application: Programming Language Semantics Prof. Dr. K. Madlener: Specification and Verification in Higher Order Logic 527 Introduction to Programming Language Semantics Programming Language

### Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus

### A Small Interpreted Language

A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

### Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

### CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

### 1 A question of semantics

PART I BACKGROUND 1 A question of semantics The goal of this chapter is to give the reader a glimpse of the applications and problem areas that have motivated and to this day continue to inspire research

### 11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations

Outline FP Foundations, Scheme In Text: Chapter 15 Mathematical foundations Functional programming λ-calculus LISP Scheme 2 Imperative Languages We have been discussing imperative languages C/C++, Java,

### About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

### 9/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

### Chapter 27 Formal Specification

Chapter 27 Formal Specification Chapter 27 Formal Specification Slide 1 Objectives To explain why formal specification helps discover problems in system requirements. To describe the use of: Algebraic

### Functional 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

### 14 Foundation of Programming Languages and Software Engineering: Summer Term 2010

14 Foundation of Programming Languages and Software Engineering: Abstract Data Types Summer Term 2010 Robert Elsässer Abstract data types 09.06.2010 Theory 1 - Foundation of Programming Languages and Software

### Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009

for Data Peter Morris University of Nottingham November 12, 2009 Introduction Outline 1 Introduction What is DTP? Data Types in DTP Schemas for Inductive Families 2 of Data Inductive Types Inductive Families

### Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

### Lecture 5. Logic I. Statement Logic

Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.

### In Our Last Exciting Episode

In Our Last Exciting Episode #1 Lessons From Model Checking To find bugs, we need specifications What are some good specifications? To convert a program into a model, we need predicates/invariants and

### Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

### Part I Basic Concepts 1

Introduction xiii Part I Basic Concepts 1 Chapter 1 Integer Arithmetic 3 1.1 Example Program 3 1.2 Computer Program 4 1.3 Documentation 5 1.4 Input 6 1.5 Assignment Statement 7 1.5.1 Basics of assignment

### Programming Languages

Programming Languages Chapter 3 Describing Syntax and Semantics Instructor: Chih-Yi Chiu 邱志義 http://sites.google.com/site/programminglanguages Outline Introduction The General Problem of Describing Syntax

### Shell CSCE 314 TAMU. Haskell Functions

1 CSCE 314: Programming Languages Dr. Dylan Shell Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions can

### Syllabi of the Comprehensive Examination in Computer Science

Syllabi of the Comprehensive Examination in Computer Science The material of the comprehensive examination is drawn mostly from the undergraduate curriculum at Kuwait University and is updated to reflect

### Special Topics: Programming Languages

Lecture #2 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture #2 Lecture #2 1 Slide 1 What Constitutes a Programming Language? Desiderata 1. Every computable function

### CS 415 Midterm Exam Spring 2002

CS 415 Midterm Exam Spring 2002 Name KEY Email Address Student ID # Pledge: This exam is closed note, closed book. Good Luck! Score Fortran Algol 60 Compilation Names, Bindings, Scope Functional Programming

### Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

### Seminar 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

### Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters Corky Cartwright January 26, 2018 Denotational Semantics The primary alternative to syntactic semantics is denotational semantics.

### Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

### The 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

### Program Calculus Calculational Programming

Program Calculus Calculational Programming National Institute of Informatics June 21 / June 28 / July 5, 2010 Program Calculus Calculational Programming What we will learn? Discussing the mathematical

### CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014 1 Introduction to Abstract Interpretation At this point in the course, we have looked at several aspects of programming languages: operational

### G COURSE PLAN ASSISTANT PROFESSOR Regulation: R13 FACULTY DETAILS: Department::

G COURSE PLAN FACULTY DETAILS: Name of the Faculty:: Designation: Department:: Abhay Kumar ASSOC PROFESSOR CSE COURSE DETAILS Name Of The Programme:: BTech Batch:: 2013 Designation:: ASSOC PROFESSOR Year

### Fundamentals of Discrete Mathematical Structures

Fundamentals of Discrete Mathematical Structures THIRD EDITION K.R. Chowdhary Campus Director JIET School of Engineering and Technology for Girls Jodhpur Delhi-110092 2015 FUNDAMENTALS OF DISCRETE MATHEMATICAL

### Data Abstraction. An Abstraction for Inductive Data Types. Philip W. L. Fong.

Data Abstraction An Abstraction for Inductive Data Types Philip W. L. Fong pwlfong@cs.uregina.ca Department of Computer Science University of Regina Regina, Saskatchewan, Canada Introduction This lecture

### CSC 501 Semantics of Programming Languages

CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this