MI-RUB Exceptions Lecture 7
|
|
- Emily Allison
- 5 years ago
- Views:
Transcription
1 MI-RUB Exceptions Lecture 7 Pavel Strnad pavel.strnad@fel.cvut.cz Dept. of Computer Science, FEE CTU Prague, Karlovo nám. 13, Praha, Czech Republic MI-RUB, WS 2011/12 Evropský sociální fond Praha & EU: Investujeme do vaší budoucnosti Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
2 Contents 1 Exceptions 2 Exception Hierarchy 3 Handling Exceptions 4 Raising Exception 5 Catch and Throw 6 Literature Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
3 Exceptions Exceptions mechanism when something goes wrong, specific reaction to an error situation, and a programming style! Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
4 Exceptions Exceptions mechanism when something goes wrong, specific reaction to an error situation, and a programming style! Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
5 Exceptions Exceptions mechanism when something goes wrong, specific reaction to an error situation, and a programming style! Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
6 Exception Class Hierarchy Figure: The above figure is from the Programming Ruby 1.9 book. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
7 Exception Class Iheritance You can raise one of the built-in exception classes. You can subclass StandardError. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
8 Exception Class Iheritance You can raise one of the built-in exception classes. You can subclass StandardError. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
9 Unhandled Exception r e q u i r e openuri web_page = open ( " h t t p : / / pragprog. com / podcasts " ) o u tput = F i l e. open ( " podcasts. html ", "w" ) while l i n e = web_page. gets o u tput. puts o u tput. close l i n e Question Where does an error occur? Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
10 Handled Exception r e q u i r e openuri page = " podcasts " file_name = " #{ page }. html " web_page = open ( " h t t p : / / pragprog. com / # { page } " ) o u tput = F i l e. open ( file_name, "w" ) begin while l i n e = web_page. gets o u tput. puts l i n e o u tput. close rescue Exception STDERR. puts " F a i l e d to download #{page } : #{$! } " o u tput. close F i l e. d e l e te ( file_name ) r a i s e Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
11 Handling Exceptions Handling Exceptions Exceptions are handled in a rescue section of a begin block. There can be more rescue blocks. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
12 Handling Exceptions Handling Exceptions Exceptions are handled in a rescue section of a begin block. There can be more rescue blocks. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
13 Handling Exceptions class MyError < StandardError begin r a i s e MyError rescue StandardError=>e puts " StandardError " rescue MyError=>e puts " MyError " Question What will be on output? Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
14 Handling Exceptions The match is made using parameter===$!. The parameter match if exception type specified in rescue is the same class or a superclass! (Same in Java) Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
15 Handling Exceptions The match is made using parameter===$!. The parameter match if exception type specified in rescue is the same class or a superclass! (Same in Java) Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
16 Tidying Up Sometimes you need to guarantee that some processing is done at the of a block of code, regardless of whether an exception was raised. For example, you may have a file open on entry to the block, and you need to make sure it gets closed as the block exits. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
17 Ensure Clause The ensure clause does just this. ensure goes after the last rescue clause and contains a chunk of code that will always be executed as the block terminates. (In Java it is finally) f = F i l e. open ( " t e s t f i l e " ) begin #.. process rescue #.. handle e r r o r ensure f. close Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
18 Raising Exception r a i s e raise Reraises the current exception (or a RuntimeError if there is no current exception). Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
19 Raising Exception r a i s e " bad mp3 encoding " raise Creates a new RuntimeError exception, setting its message to the given string. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
20 Raising Exception r a i s e InterfaceException, " Keyboard f a i l u r e ", c a l l e r raise Uses the first argument to create an exception and then sets the associated message to the second argument and the stack trace to the third argument. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
21 Play it = tru e begin i f rescue i ehlo ( helodom ) helo ( helodom ) P r o t o c o l E r r o = false r e t r y else r a i s e Retry is not recommed to use. You can easily create infinite loop. Retry will execute begin block again. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
22 Catch! w o r d _ l i s t = F i l e. open ( " w o r d l i s t " ) catch ( : done ) do r e s u l t = [ ] while l i n e = w o r d _ l i s t. gets word = l i n e. chomp puts throw : done unless word =~ / ^ \ w+$ / r e s u l t << word r e s u l t. reverse catch defines a block that is labeled with the given name (which may be a Symbol or a String). The block is executed normally until a throw is encountered. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
23 Catch! w o r d _ l i s t = F i l e. open ( " w o r d l i s t " ) word_in_error = catch ( : done ) do r e s u l t = [ ] while l i n e = w o r d _ l i s t. gets puts word = l i n e. chomp throw ( : done, word ) unless word =~ / ^ \ w+$ / r e s u l t << word r e s u l t. reverse i f word_in_erro r puts " F a i l e d : # { word_in_erro r } found, but a word was expected " produces : F a i l e d : wow found, but a word was expected catch returns a value if a second argument to throw is given. Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
24 All examples are from Pavel Strnad (Czech Technical University in Prague) MI-RUB Exceptions Lecture 7 MI-RUB, / 19
MI-RUB Testing Lecture 10
MI-RUB Testing Lecture 10 Pavel Strnad pavel.strnad@fel.cvut.cz Dept. of Computer Science, FEE CTU Prague, Karlovo nám. 13, 121 35 Praha, Czech Republic MI-RUB, WS 2011/12 Evropský sociální fond Praha
More informationMI-RUB Testing II Lecture 11
MI-RUB Testing II Lecture 11 Pavel Strnad pavel.strnad@fel.cvut.cz Dept. of Computer Science, FEE CTU Prague, Karlovo nám. 13, 121 35 Praha, Czech Republic MI-RUB, WS 2011/12 Evropský sociální fond Praha
More informationBinary Decision Diagrams
Binary Decision Diagrams Logic Circuits Design Seminars WS2010/2011, Lecture 2 Ing. Petr Fišer, Ph.D. Department of Digital Design Faculty of Information Technology Czech Technical University in Prague
More informationNonlinearOptimization
1/35 NonlinearOptimization Pavel Kordík Department of Computer Systems Faculty of Information Technology Czech Technical University in Prague Jiří Kašpar, Pavel Tvrdík, 2011 Unconstrained nonlinear optimization,
More informationBranch-and-Bound Algorithm. Pattern Recognition XI. Michal Haindl. Outline
Branch-and-Bound Algorithm assumption - can be used if a feature selection criterion satisfies the monotonicity property monotonicity property - for nested feature sets X j related X 1 X 2... X l the criterion
More informationNotation. Pattern Recognition II. Michal Haindl. Outline - PR Basic Concepts. Pattern Recognition Notions
Notation S pattern space X feature vector X = [x 1,...,x l ] l = dim{x} number of features X feature space K number of classes ω i class indicator Ω = {ω 1,...,ω K } g(x) discriminant function H decision
More informationComputational intelligence methods
Computational intelligence methods GA, schemas, diversity Pavel Kordík, Martin Šlapák Katedra teoretické informatiky FIT České vysoké učení technické v Praze MI-MVI, ZS 2011/12, Lect. 5 https://edux.fit.cvut.cz/courses/mi-mvi/
More informationSet Theory. Pattern Recognition III. Michal Haindl. Set Operations. Outline
Set Theory A, B sets e.g. A = {ζ 1,...,ζ n } A = { c x y d} S space (universe) A,B S Outline Pattern Recognition III Michal Haindl Faculty of Information Technology, KTI Czech Technical University in Prague
More informationNeural Nets in PR. Pattern Recognition XII. Michal Haindl. Outline. Neural Nets in PR 2
Neural Nets in PR NM P F Outline Motivation: Pattern Recognition XII human brain study complex cognitive tasks Michal Haindl Faculty of Information Technology, KTI Czech Technical University in Prague
More informationQuantum computing. Jan Černý, FIT, Czech Technical University in Prague. České vysoké učení technické v Praze. Fakulta informačních technologií
České vysoké učení technické v Praze Fakulta informačních technologií Katedra teoretické informatiky Evropský sociální fond Praha & EU: Investujeme do vaší budoucnosti MI-MVI Methods of Computational Intelligence(2010/2011)
More informationComputer Science Introductory Course MSc - Introduction to Java
Computer Science Introductory Course MSc - Introduction to Java Lecture 3:,, Pablo Oliveira ENST Outline 1 2 3 Definition An exception is an event that indicates an abnormal condition
More informationLists, Stacks, and Queues (plus Priority Queues)
Lists, Stacks, and Queues (plus Priority Queues) The structures lists, stacks, and queues are composed of similar elements with different operations. Likewise, with mathematics: (Z, +, 0) vs. (Z,, 1) List
More informationFeature Selection. Pattern Recognition X. Michal Haindl. Feature Selection. Outline
Feature election Outline Pattern Recognition X motivation technical recognition problem dimensionality reduction ց class separability increase ր data compression (e.g. required communication channel capacity)
More informationMultilevel Logic Synthesis Algebraic Methods
Multilevel Logic Synthesis Algebraic Methods Logic Circuits Design Seminars WS2010/2011, Lecture 6 Ing. Petr Fišer, Ph.D. Department of Digital Design Faculty of Information Technology Czech Technical
More informationPython. chrysn
Python chrysn 2008-09-25 Introduction Structure, Language & Syntax Strengths & Weaknesses Introduction Structure, Language & Syntax Strengths & Weaknesses Python Python is an interpreted,
More informationMarkovské řetězce se spojitým parametrem
Markovské řetězce se spojitým parametrem Mgr. Rudolf B. Blažek, Ph.D. prof. RNDr. Roman Kotecký, DrSc. Katedra počítačových systémů Katedra teoretické informatiky Fakulta informačních technologií České
More informationTuring Machines Part Three
Turing Machines Part Three What problems can we solve with a computer? What kind of computer? Very Important Terminology Let M be a Turing machine. M accepts a string w if it enters an accept state when
More information1 Classical Propositional Logic [20 points]
Homework 1 Solutions 15-414/614 : Bug Catching, Spring 2014 1 Classical Propositional Logic [20 points] Let x, y and z be three propositions. (a) (8 points) Show that the two propositional formulas, (x
More informationCS481F01 Prelim 2 Solutions
CS481F01 Prelim 2 Solutions A. Demers 7 Nov 2001 1 (30 pts = 4 pts each part + 2 free points). For this question we use the following notation: x y means x is a prefix of y m k n means m n k For each of
More informationDM507 - Algoritmer og Datastrukturer Project 1
DM507 - Algoritmer og Datastrukturer Project 1 Christian Skjøth Mat-Øk 280588 Morten Olsen Mat-Øk 090789 19. marts 2012 Task 1 - Double for-loop So, first we needed to create an instance of the class File
More informationLecture VII Part 2: Syntactic Analysis Bottom-up Parsing: LR Parsing. Prof. Bodik CS Berkley University 1
Lecture VII Part 2: Syntactic Analysis Bottom-up Parsing: LR Parsing. Prof. Bodik CS 164 -- Berkley University 1 Bottom-Up Parsing Bottom-up parsing is more general than topdown parsing And just as efficient
More informationSoftwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany
Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationSoftwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany
Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationSyntactic 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 informationCSE505, Fall 2012, Final Examination December 10, 2012
CSE505, Fall 2012, Final Examination December 10, 2012 Rules: The exam is closed-book, closed-notes, except for one side of one 8.5x11in piece of paper. Please stop promptly at 12:20. You can rip apart
More informationClojure Concurrency Constructs, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 13 10/07/2014
Clojure Concurrency Constructs, Part Two CSCI 5828: Foundations of Software Engineering Lecture 13 10/07/2014 1 Goals Cover the material presented in Chapter 4, of our concurrency textbook In particular,
More informationPredictive parsing as a specific subclass of recursive descent parsing complexity comparisons with general parsing
Plan for Today Recall Predictive Parsing when it works and when it doesn t necessary to remove left-recursion might have to left-factor Error recovery for predictive parsers Predictive parsing as a specific
More informationDeclarative 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 informationLoop Invariants and Binary Search. Chapter 4.4, 5.1
Loop Invariants and Binary Search Chapter 4.4, 5.1 Outline Iterative Algorithms, Assertions and Proofs of Correctness Binary Search: A Case Study Outline Iterative Algorithms, Assertions and Proofs of
More informationBootstrap metody II Kernelové Odhady Hustot
Bootstrap metody II Kernelové Odhady Hustot Mgr. Rudolf B. Blažek, Ph.D. prof. RNDr. Roman Kotecký, DrSc. Katedra počítačových systémů Katedra teoretické informatiky Fakulta informačních technologií České
More informationCOMP 204. Exceptions continued. Yue Li based on material from Mathieu Blanchette, Carlos Oliver Gonzalez and Christopher Cameron
COMP 204 Exceptions continued Yue Li based on material from Mathieu Blanchette, Carlos Oliver Gonzalez and Christopher Cameron 1 / 27 Types of bugs 1. Syntax errors 2. Exceptions (runtime) 3. Logical errors
More informationComp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40
Comp 11 Lectures Mike Shah Tufts University July 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 26, 2017 1 / 40 Please do not distribute or host these slides without prior permission. Mike
More informationIntroduction to Python and its unit testing framework
Introduction to Python and its unit testing framework Instructions These are self evaluation exercises. If you know no python then work through these exercises and it will prepare yourself for the lab.
More informationVerification of Recursive Programs. Andreas Podelski February 8, 2012
Verification of Recursive Programs Andreas Podelski February 8, 2012 1 m(x) = x 10 if x > 100 m(m(x + 11)) if x 100 2 procedure m(x) returns (res) `0: if x>100 `1: res:=x-10 else `2: x m := x+11 `3: res
More informationComputational Intelligence Methods
Computational Intelligence Methods Ant Colony Optimization, Partical Swarm Optimization Pavel Kordík, Martin Šlapák Katedra teoretické informatiky FIT České vysoké učení technické v Praze MI-MVI, ZS 2011/12,
More informationSoftware Engineering
Software Engineering Lecture 07: Design by Contract Peter Thiemann University of Freiburg, Germany 02.06.2014 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationMURA Office hours Thurs at 12-1pm in CIT 546 Contact for more info.
Course Announcements Lecture capture has begun, available from Lectures page. First two and a half weeks are packed. Testing lab done, HTML started, and Stars due next Friday. Department has a lot of student
More informationData Flow Analysis. Lecture 6 ECS 240. ECS 240 Data Flow Analysis 1
Data Flow Analysis Lecture 6 ECS 240 ECS 240 Data Flow Analysis 1 The Plan Introduce a few example analyses Generalize to see the underlying theory Discuss some more advanced issues ECS 240 Data Flow Analysis
More informationZáklady teorie front II
Základy teorie front II Aplikace Poissonova procesu v teorii front Mgr. Rudolf B. Blažek, Ph.D. prof. RNDr. Roman Kotecký, DrSc. Katedra počítačových systémů Katedra teoretické informatiky Fakulta informačních
More informationTuring Machines Part II
Turing Machines Part II Problem Set Set Five Five due due in in the the box box up up front front using using a late late day. day. Hello Hello Condensed Slide Slide Readers! Readers! This This lecture
More informationLecture 13: Soundness, Completeness and Compactness
Discrete Mathematics (II) Spring 2017 Lecture 13: Soundness, Completeness and Compactness Lecturer: Yi Li 1 Overview In this lecture, we will prvoe the soundness and completeness of tableau proof system,
More informationTuring Machines Part II
Turing Machines Part II Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing
More informationSpace-aware data flow analysis
Space-aware data flow analysis C. Bernardeschi, G. Lettieri, L. Martini, P. Masci Dip. di Ingegneria dell Informazione, Università di Pisa, Via Diotisalvi 2, 56126 Pisa, Italy {cinzia,g.lettieri,luca.martini,paolo.masci}@iet.unipi.it
More informationString Matching. Thanks to Piotr Indyk. String Matching. Simple Algorithm. for s 0 to n-m. Match 0. for j 1 to m if T[s+j] P[j] then
String Matching Thanks to Piotr Indyk String Matching Input: Two strings T[1 n] and P[1 m], containing symbols from alphabet Σ Goal: find all shifts 0 s n-m such that T[s+1 s+m]=p Example: Σ={,a,b,,z}
More informationA Note on Turing Machine Design
CS103 Handout 17 Fall 2013 November 11, 2013 Problem Set 7 This problem explores Turing machines, nondeterministic computation, properties of the RE and R languages, and the limits of RE and R languages.
More informationRecognizing Safety and Liveness by Alpern and Schneider
Recognizing Safety and Liveness by Alpern and Schneider Calvin Deutschbein 17 Jan 2017 1 Intro 1.1 Safety What is safety? Bad things do not happen For example, consider the following safe program in C:
More informationFlow grammars a flow analysis methodology
Flow grammars a flow analysis methodology James S. Uhl and R. Nigel Horspool Dept. of Computer Science, University of Victoria P.O. Box 3055, Victoria, BC, Canada V8W 3P6 E-mail: juhl@csr.uvic.ca, nigelh@csr.uvic.ca
More informationCSci 311, Models of Computation Chapter 4 Properties of Regular Languages
CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular
More informationOverview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions
Note 01 Propositional Logic 1 / 10-1 Overview 1. Introduction to Propositional Logic 2. Operations on Propositions 3. Truth Tables 4. Translating Sentences into Logical Expressions 5. Preview: Propositional
More informationTheory of Computation
Theory of Computation Lecture #10 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 43 Lecture 10: Overview Linear Bounded Automata Acceptance Problem for LBAs
More information6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.
6.045J/18.400J: Automata, Computability and Complexity March 30, 2005 Quiz 2 Prof. Nancy Lynch Please write your name in the upper corner of each page. Problem Score 1 2 3 4 5 6 Total Q2-1 Problem 1: True
More informationAnswers to the CSCE 551 Final Exam, April 30, 2008
Answers to the CSCE 55 Final Exam, April 3, 28. (5 points) Use the Pumping Lemma to show that the language L = {x {, } the number of s and s in x differ (in either direction) by at most 28} is not regular.
More informationPart I: Definitions and Properties
Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States
More informationLR(1) Parsers Part III Last Parsing Lecture. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved.
LR(1) Parsers Part III Last Parsing Lecture Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. LR(1) Parsers A table-driven LR(1) parser looks like source code Scanner Table-driven Parser
More informationParity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process
Parity Checker Example A string of bits has even parity if the number of 1 s in the string is even. Design a circuit that accepts a bit-serial stream of bits and outputs a 0 if the parity thus far is even
More informationCSE 105 Theory of Computation
CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Undecidability Today s Agenda Review: The TM Acceptance problem, A TM The Halting Problem for TM s Other problems
More informationL435/L555. Dept. of Linguistics, Indiana University Fall 2016
in in L435/L555 Dept. of Linguistics, Indiana University Fall 2016 1 / 13 in we know how to output something on the screen: print( Hello world. ) input: input() returns the input from the keyboard
More informationGoogle Go illustrated on the basis of Fibonacci numbers
Google Go illustrated on the basis of Fibonacci numbers Jan Pennekamp RWTH University Aachen Chair for Data Management and Data Exploration Prof. Dr. T. Seidl Supervision: Dipl.-Ing. Marwan Hassani Friday,
More informationDecision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012
Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM
More informationChemical reaction networks and diffusion
FYTN05 Fall 2012 Computer Assignment 2 Chemical reaction networks and diffusion Supervisor: Erica Manesso (Office: K217, Phone: +46 46 22 29232, E-mail: erica.manesso@thep.lu.se) Deadline: October 23,
More informationToday s Lecture. Lecture 4: Formal SE. Some Important Points. Formal Software Engineering. Introduction to Formal Software Engineering
Today s Lecture Lecture 4: Formal SE Introduction to Formal Software Engineering Discuss Models Discuss Formal Notations Kenneth M. Anderson Foundations of Software Engineering CSCI 5828 - Spring Semester,
More informationNotes for Lecture Notes 2
Stanford University CS254: Computational Complexity Notes 2 Luca Trevisan January 11, 2012 Notes for Lecture Notes 2 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation
More informationTuring Machines. Lecture 8
Turing Machines Lecture 8 1 Course Trajectory We will see algorithms, what can be done. But what cannot be done? 2 Computation Problem: To compute a function F that maps each input (a string) to an output
More informationExtensibility Patterns: Extension Access
Design Patterns and Frameworks Dipl.-Medieninf. Christian Piechnick INF 2080 christian.piechnick@tu-dresden.de Exercise Sheet No. 5 Software Technology Group Institute for SMT Department of Computer Science
More informationChapter 7 Turing Machines
Chapter 7 Turing Machines Copyright 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 A General Model of Computation Both finite automata and pushdown automata are
More information1 Background: Balancing Chemical Reactions
MSE 35 Balancing Chemical Reactions Instructor: R.G. Erdmann In this project, worth -2 points, you will write software to automatically balance chemical reactions. Background: Balancing Chemical Reactions.
More informationCole s MergeSort. prof. Ing. Pavel Tvrdík CSc. Fakulta informačních technologií České vysoké učení technické v Praze c Pavel Tvrdík, 2010
Cole s MergeSort prof. Ing. Pavel Tvrdík CSc. Katedra počítačových systémů Fakulta informačních technologií České vysoké učení technické v Praze c Pavel Tvrdík, 2010 Pokročilé paralelní algoritmy (PI-PPA)
More information33. SOLVING LINEAR INEQUALITIES IN ONE VARIABLE
get the complete book: http://wwwonemathematicalcatorg/getfulltextfullbookhtm 33 SOLVING LINEAR INEQUALITIES IN ONE VARIABLE linear inequalities in one variable DEFINITION linear inequality in one variable
More informationRobust Programs with Filtered Iterators
Robust Programs with Filtered Iterators Jiasi Shen, Martin Rinard MIT EECS & CSAIL 1 Standard Scenario Input file Program Output 2 Structured Input Units Input Input unit Input unit Input unit unit Program
More informationTou has been released!
Tou has been released! Shoot- em-up, heavy use of collision detection Much more open-ended than previous projects Easier than previous projects if you work smart Should help those of you combating the
More informationPath Testing and Test Coverage. Chapter 9
Path Testing and Test Coverage Chapter 9 Structural Testing Also known as glass/white/open box testing Structural testing is based on using specific knowledge of the program source text to define test
More informationRoot finding. Eugeniy E. Mikhailov. Lecture 06. The College of William & Mary. Eugeniy Mikhailov (W&M) Practical Computing Lecture 06 1 / 10
Root finding Eugeniy E. Mikhailov The College of William & Mary Lecture 06 Eugeniy Mikhailov (W&M) Practical Computing Lecture 06 1 / 10 Root finding problem Generally we want to solve the following canonical
More information(a) Definition of TMs. First Problem of URMs
Sec. 4: Turing Machines First Problem of URMs (a) Definition of the Turing Machine. (b) URM computable functions are Turing computable. (c) Undecidability of the Turing Halting Problem That incrementing
More informationPath Testing and Test Coverage. Chapter 9
Path Testing and Test Coverage Chapter 9 Structural Testing Also known as glass/white/open box testing Structural testing is based on using specific knowledge of the program source text to define test
More informationWhat languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?
} We ll now take a look at Turing Machines at a high level and consider what types of problems can be solved algorithmically and what types can t: What languages are Turing-decidable? What languages are
More informationProgram Analysis. Lecture 5. Rayna Dimitrova WS 2016/2017
Program Analysis Lecture 5 Rayna Dimitrova WS 2016/2017 2/21 Recap: Constant propagation analysis Goal: For each program point, determine whether a variale has a constant value whenever an execution reaches
More informationProving languages to be nonregular
Proving languages to be nonregular We already know that there exist languages A Σ that are nonregular, for any choice of an alphabet Σ. This is because there are uncountably many languages in total and
More informationCSE 311: Foundations of Computing. Lecture 27: Undecidability
CSE 311: Foundations of Computing Lecture 27: Undecidability Last time: Countable sets A set is countable iff we can order the elements of as = {,,, Countable sets: N-the natural numbers Z - the integers
More informationParsing with CFGs L445 / L545 / B659. Dept. of Linguistics, Indiana University Spring Parsing with CFGs. Direction of processing
L445 / L545 / B659 Dept. of Linguistics, Indiana University Spring 2016 1 / 46 : Overview Input: a string Output: a (single) parse tree A useful step in the process of obtaining meaning We can view the
More informationParsing with CFGs. Direction of processing. Top-down. Bottom-up. Left-corner parsing. Chart parsing CYK. Earley 1 / 46.
: Overview L545 Dept. of Linguistics, Indiana University Spring 2013 Input: a string Output: a (single) parse tree A useful step in the process of obtaining meaning We can view the problem as searching
More informationCMSC 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 informationReductions in Computability Theory
Reductions in Computability Theory Prakash Panangaden 9 th November 2015 The concept of reduction is central to computability and complexity theory. The phrase P reduces to Q is often used in a confusing
More informationEDA045F: 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 informationAmbiguity, Precedence, Associativity & Top-Down Parsing. Lecture 9-10
Ambiguity, Precedence, Associativity & Top-Down Parsing Lecture 9-10 (From slides by G. Necula & R. Bodik) 2/13/2008 Prof. Hilfinger CS164 Lecture 9 1 Administrivia Team assignments this evening for all
More informationAdvanced Topics in LP and FP
Lecture 1: Prolog and Summary of this lecture 1 Introduction to Prolog 2 3 Truth value evaluation 4 Prolog Logic programming language Introduction to Prolog Introduced in the 1970s Program = collection
More informationFormal Reasoning CSE 331. Lecture 2 Formal Reasoning. Announcements. Formalization and Reasoning. Software Design and Implementation
CSE 331 Software Design and Implementation Lecture 2 Formal Reasoning Announcements Homework 0 due Friday at 5 PM Heads up: no late days for this one! Homework 1 due Wednesday at 11 PM Using program logic
More informationDecidable Languages - relationship with other classes.
CSE2001, Fall 2006 1 Last time we saw some examples of decidable languages (or, solvable problems). Today we will start by looking at the relationship between the decidable languages, and the regular and
More informationVISUALIZING PSEUDOSPECTRA FOR POLYNOMIAL EIGENVALUE PROBLEMS. Adéla Klimentová *, Michael Šebek ** Czech Technical University in Prague
VSUALZNG PSEUDOSPECTRA FOR POLYNOMAL EGENVALUE PROBLEMS Adéla Klimentová *, Michael Šebek ** * Department of Control Engineering Czech Technical University in Prague ** nstitute of nformation Theory and
More informationTuring s 1935: my guess about his intellectual journey to On Co
Turing s 1935: my guess about his intellectual journey to On Computable Numbers Dept. of Computer Science & Engineering Seoul National University 7/11/2017 @ The 15th Asian Logic Conference, Daejeon Turing
More informationGeneral Physics - E&M (PHY 1308) - Lecture Notes. General Physics - E&M (PHY 1308) Lecture Notes
General Physics - E&M (PHY 1308) Lecture Notes Lecture 013: Batteries and Circuit Analysis SteveSekula, 7 March 2011 (created 2 March 2011) Ideal and Real Batteries no tags Let's take a moment to talk
More informationLecture for Week 2 (Secs. 1.3 and ) Functions and Limits
Lecture for Week 2 (Secs. 1.3 and 2.2 2.3) Functions and Limits 1 First let s review what a function is. (See Sec. 1 of Review and Preview.) The best way to think of a function is as an imaginary machine,
More informationCOMS 6100 Class Notes
COMS 6100 Class Notes Daniel Solus November 1, 2016 1 General Remarks We will start with a small overview of the material from the end of last class. Since we were interrupted by the fire alarm. 2 Review
More informationMTH401A Theory of Computation. Lecture 17
MTH401A Theory of Computation Lecture 17 Chomsky Normal Form for CFG s Chomsky Normal Form for CFG s For every context free language, L, the language L {ε} has a grammar in which every production looks
More informationComputation Theory Finite Automata
Computation Theory Dept. of Computing ITT Dublin October 14, 2010 Computation Theory I 1 We would like a model that captures the general nature of computation Consider two simple problems: 2 Design a program
More informationRoot finding. Eugeniy E. Mikhailov. Lecture 05. The College of William & Mary. Eugeniy Mikhailov (W&M) Practical Computing Lecture 05 1 / 10
Root finding Eugeniy E. Mikhailov The College of William & Mary Lecture 05 Eugeniy Mikhailov (W&M) Practical Computing Lecture 05 1 / 10 Root finding problem Generally we want to solve the following canonical
More informationEvolving a New Feature for a Working Program
Evolving a New Feature for a Working Program Mike Stimpson arxiv:1104.0283v1 [cs.ne] 2 Apr 2011 January 18, 2013 Abstract A genetic programming system is created. A first fitness function f 1 is used to
More informationContinuing discussion of CRC s, especially looking at two-bit errors
Continuing discussion of CRC s, especially looking at two-bit errors The definition of primitive binary polynomials Brute force checking for primitivity A theorem giving a better test for primitivity Fast
More informationECE3510 Lab #5 PID Control
ECE3510 Lab #5 ID Control Objectives The objective of this lab is to study basic design issues for proportionalintegral-derivative control laws. Emphasis is placed on transient responses and steady-state
More informationProving Programs Correct
Proving Programs Correct Page 1 of 9 Proving Programs Correct How can we be sure that a piece of code does what we want it to do? One way is to try testing the code on a large group of data. Another is
More informationCpSc 421 Homework 9 Solution
CpSc 421 Homework 9 Solution Attempt any three of the six problems below. The homework is graded on a scale of 100 points, even though you can attempt fewer or more points than that. Your recorded grade
More information