Google Go illustrated on the basis of Fibonacci numbers

Size: px
Start display at page:

Download "Google Go illustrated on the basis of Fibonacci numbers"

Transcription

1 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, 29st June 2012 slide 1 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

2 1 Introduction 2 Basics about Go 3 Example: Fibonacci numbers 4 Conclusion 5 Bibliography 6 Additional slide 2 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

3 Main developers Ken Thompson * 1943 Unix shell B (programming language) UTF-8 slide 3 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

4 Main developers Ken Thompson * 1943 Rob Pike * 1956 Unix shell B (programming language) UTF-8 Plan 9 (operating system) UTF-8 slide 3 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

5 Go s goals today s C secure fast to compile easy to code slide 4 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

6 Go s goals today s C secure fast to compile easy to code for every project and environment slide 4 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

7 Go s goals today s C secure fast to compile easy to code for every project and environment => advantages of imperative and dynamic programming slide 4 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

8 History of Go open source project financed by Google slide 5 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

9 History of Go open source project financed by Google initial design public release TIOBE award 09 Sep Nov Jan used at Google Go 1 release May 2010 Mar slide 5 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

10 Influences on Go slide 6 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

11 Recent release: Go1 Windows compiler final syntax stable converter for Go to Go1 code slide 7 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

12 Hello World 1 // Hello World program in Google Go 2 package main 3 4 import " fmt " 5 6 func main () { 7 fmt. Println (" Hello world ") 8 } slide 8 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

13 Built-in data types Integer int8, int16, int32, uint8,... Float float32, float64 Other complex64, complex128, string, char, uchar Boolean bool slide 9 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

14 Built-in data types Integer int8, int16, int32, uint8,... Float float32, float64 Other complex64, complex128, string, char, uchar Boolean bool structs anonymous structs collections slide 9 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

15 Loops implemented in Go only for loops slide 10 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

16 Loops implemented in Go only for loops 1 // regular for loop 2 for i := 0; i < 10; i++ {... } 3 4 // while loop 5 for ; sum < 1000; {... } 6 for sum < 1000 {... } 7 8 // infinite loop 9 for ; ; {... } 10 for true {... } 11 for {... } slide 10 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

17 Control structures complex switch command break, continue GoTo (contradiction to Go s goals) slide 11 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

18 Miscellaneous pointer used for cbv, cbr no real pointer aritmetic garbage collector slide 12 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

19 Miscellaneous pointer used for cbv, cbr no real pointer aritmetic garbage collector package system, interfaces godoc, gofmt slide 12 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

20 Overview important example in computer science Pascal & Java commonly known slide 13 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

21 Overview important example in computer science Pascal & Java commonly known both with influence on Go slide 13 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

22 Overview important example in computer science Pascal & Java commonly known both with influence on Go shows advantages and easyness of Go slide 13 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

23 If-else chains 1 // if - else chain - exception handling 2 switch { 3 case n <= 0: 4 return 0, 1, err. New (" Number lower / equal zero, try again.") 5 case n >= 100: 6 return 0, 1, err. New (" Number higher / equal 100, try again.") 7 } slide 14 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

24 Multiple return values 1 // function declaration 2 func fib (a, b int64, n int ) ( int64, int64, error ) { 3 // name parameters return values 4 5 // function call 6 _,res, err := fib (0,1,n) 7 // return values name parameters slide 15 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

25 Multiple assignments 1 // multiple assignments in Go 2 b, a = a+b, b 3 // uses the values of the variables before the call slide 16 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

26 Rating advantages: keeps it goals has a future in development modern language slide 17 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

27 Rating advantages: keeps it goals has a future in development modern language disadvantages: assoziated with Google hardly literature slide 17 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

28 Own opinion easy to learn for every project fast compile time has a future slide 18 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

29 Own opinion easy to learn for every project fast compile time has a future => good requirements to become today s C slide 18 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

30 Additional features goroutines channels native network support... slide 19 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

31 Questions Thank you for your attention! Any questions? slide 20 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

32 Bibliography - Books books: Ivo Balbaert. The Way to Go - A Thorough Introduction to the Go Programming Language Rainer Feike and Steffen Blass. Programmierung in Google Go Frank Müller. Systemprogrammierung in Google Go - Grundlagen- Skalierbarkeit- Performanz- Sicherheit slide 21 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

33 Bibliography - Books internet: slide 22 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

34 Structs 1 type example struct { 2 number int 3 name string 4 } var ( 7 valuea example = example {1, " one "} 8 valueb example = example {2, " two "} 9 ) slide 23 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

35 Package import 1 import ( 2. " fmt " 3 err " errors " 4 ) err. New (" Number lower / equal zero, try again.") Printf (" The fibonacci number of %v is %v\n",n, res ) slide 24 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

36 Google Go version 1 package main 2 // package i m p o r t 3 i m p o r t ( 4. fmt 5 e r r e r r o r s 6 ) 7 8 // f u n c t i o n w i t h 3 r e t u r n v a l u e s 9 f u n c f i b ( a, b i n t 6 4, n i n t ) ( i n t 6 4, i n t 6 4, e r r o r ) { 10 // i f e l s e chain exception handling 11 s w i t c h { 12 case n <= 0 : 13 r e t u r n 0, 1, e r r. New( Number l o w e r / e q u a l zero, t r y a g a i n. ) 14 case n >= 100: 15 r e t u r n 0, 1, e r r. New( Number h i g h e r / e q u a l 100, t r y a g a i n. ) 16 } 17 // c a l c u l a t i o n 18 f o r i := i n t ( b ) ; i < n ; i++ { 19 b, a = a+b, b 20 } 21 r e t u r n a, b, n i l 22 } slide 25 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

37 Google Go version (continuation) 1 // main p r o c e d u r e 2 f u n c main ( ) { 3 v a r n i n t 4 f. P r i n t f ( This program c a l c u l a t e s t h e f i b o n a c c i numbers i t e r a t i v e.\ n ) 5 // w h i l e l o o p 6 f o r { 7 f. P r i n t f ( Which f i b o n a c c i number s h o u l d be computed?\n ) 8 f. Scanf ( %d, &n ) 9 // f u n c t i o n c a l l 10, r e s, e r r := f i b ( 0, 1, n ) 11 i f e r r!= n i l { 12 f. P r i n t l n ( e r r ) // e r r o r o u tput 13 } e l s e { 14 f. P r i n t f ( The f i b o n a c c i number o f %v i s %v\n, n, r e s ) // r e s u l t o u t p u t 15 } 16 } 17 } 18 // 707 c h a r a c t e r s w i t h o u t comments slide 26 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

38 Java version 1 p u b l i c c l a s s F i b o n a c c i { 2 // f u n c t i o n 3 p u b l i c s t a t i c l o n g f i b ( i n t n ) 4 throws FibonacciNegativeException, FibonacciTooBigException { 5 // i f e l s e chain exception handling 6 i f ( n <= 0) 7 throw new F i b o n a c c i N e g a t i v e E x c e p t i o n ( ) ; 8 i f ( n >= 100) 9 throw new FibonacciTooBigException ( ) ; 10 // c a l c u l a t i o n 11 l o n g a = 0, b = 1, c ; 12 f o r ( i n t i = 2 ; i <= n ; i ++) { 13 c = a + b ; 14 a = b ; 15 b = c ; 16 } 17 r e t u r n b ; 18 } slide 27 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

39 Java version (continuation) 1 // main p r o c e d u r e 2 p u b l i c s t a t i c v o i d main ( S t r i n g [ ] a r g s ) { 3 System. out. p r i n t l n ( This program c a l c u l a t e s t h e f i b o n a c c i numbers i t e r a t i v e. ) ; 4 // w h i l e l o o p 5 w h i l e ( t r u e ) { 6 System. out. p r i n t l n ( Which f i b o n a c c i number s h o u l d be computed? ) ; 7 i n t n =I n t e g e r. p a r s e I n t ( System. c o n s o l e ( ). r e a d L i n e ( ) ) ; 8 System. out. p r i n t l n ( ) ; 9 // r e s u l t o u t p u t 10 t r y { System. out. p r i n t l n ( The f i b o n a c c i number o f + n + i s + f i b ( n ) ) ; } 11 catch ( FibonacciNegativeException fne ) // e r r o r output 12 {System. out. p r i n t l n ( Number l o w e r / e q u a l zero, t r y a g a i n. ) ;} 13 catch ( FibonacciTooBigException ftbe ) // e r r o r output 14 {System. out. p r i n t l n ( Number h i g h e r / e q u a l 100, t r y a g a i n. ) ;} 15 System. out. p r i n t l n ( ) ; 16 } 17 } 18 } 19 // 1020 c h a r a c t e r s w i t h o u t comments slide 28 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

40 Pascal version 1 PROGRAM f i b o n a c c i ; 2 USES c r t ; // package i m p o r t 3 VAR n : INTEGER ; 4 re s : LONGINT ; 5 6 // f u n c t i o n 7 FUNCTION F i b o n a c c i ( n : INTEGER) : LONGINT ; 8 VAR i : INTEGER ; 9 a, b, c : LONGINT ; 10 BEGIN 11 // c a l c u l a t i o n 12 a := 0 ; b := 1 ; 13 FOR i := 2 TO n DO 14 BEGIN 15 c := a + b ; 16 a := b ; 17 b := c ; 18 END; 19 Fibonacci := b ; 20 END; slide 29 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

41 Pascal version (continuation) 1 // main p r o c e d u r e 2 BEGIN 3 W r i t e l n ( This program c a l c u l a t e s t h e f i b o n a c c i numbers i t e r a t i v e. ) ; 4 // w h i l e l o o p 5 WHILE ( t r u e ) DO 6 BEGIN 7 REPEAT 8 W r i t e l n ( Which f i b o n a c c i number s h o u l d be computed? ) ; 9 Readln ( n ) ; 10 // e x c e p t i o n h a n d l i n g 11 IF ( n <= 0) 12 THEN W r i t e l n ( Number l o w e r / e q u a l zero, t r y a g a i n. ) 13 ELSE IF ( n >= 100) 14 THEN W r i t e l n ( Number h i g h e r / e q u a l 100, t r y a g a i n. ) ; 15 UNTIL ( n > 0) AND ( n < 100) ; 16 Writeln ; 17 // f u n c t i o n c a l l 18 r e s := F i b o n a c c i ( n ) ; 19 W r i t e l n ( The f i b o n a c c i number o f, n, i s, r e s ) ; // r e s u l t o u t p u t 20 Writeln ; 21 END; 22 END. 23 // 760 c h a r a c t e r s w i t h o u t comments slide 30 of 30 Jan Pennekamp Google Go illustrated on the basis of Fibonacci numbers

Go Tutorial. Ian Lance Taylor. Introduction. Why? Language. Go Tutorial. Ian Lance Taylor. GCC Summit, October 27, 2010

Go Tutorial. Ian Lance Taylor. Introduction. Why? Language. Go Tutorial. Ian Lance Taylor. GCC Summit, October 27, 2010 GCC Summit, October 27, 2010 Go Go is a new experimental general purpose programming language. Main developers are: Russ Cox Robert Griesemer Rob Pike Ken Thompson It was released as free software in November

More information

CompA - Complex Analyzer

CompA - Complex Analyzer CompA - Complex Analyzer Xiping Liu(xl2639), Jianshuo Qiu(jq2253), Tianwu Wang(tw2576), Yingshuang Zheng(yz3083), Zhanpeng Su(zs2329) Septembee 25, 2017 1 Introduction The motivation for writing this language

More information

Introduction to the Go Programming Language

Introduction to the Go Programming Language Introduction to the Go Programming Language Fabian Wenzelmann August 1, 2017 F. Wenzelmann Introduction to Go August 1, 2017 1 / 126 Why Go? What is Go? Go is a programming language developed at Google

More information

1. Write a program to calculate distance traveled by light

1. Write a program to calculate distance traveled by light G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a

More information

CS Exam 1 Study Guide and Practice Exam

CS Exam 1 Study Guide and Practice Exam CS 150 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Suggestions, Warnings, and Resources.................................

More information

DARN: A Matrix Manipulation Language

DARN: A Matrix Manipulation Language DARN: A Matrix Manipulation Language Daisy Chaussee (dac2183) Anthony Kim (ak3703) Rafael Takasu (rgt2108) Ignacio (Nacho) Torras (it2216) December 20, 2016 1 Contents 1 Introduction to the Language 4

More information

Python. chrysn

Python. chrysn Python chrysn 2008-09-25 Introduction Structure, Language & Syntax Strengths & Weaknesses Introduction Structure, Language & Syntax Strengths & Weaknesses Python Python is an interpreted,

More information

Extensibility Patterns: Extension Access

Extensibility 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 information

Functional Programming with F# Overview and Basic Concepts

Functional Programming with F# Overview and Basic Concepts Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference

More information

Übung Informatik I - Programmierung - Blatt 7

Übung Informatik I - Programmierung - Blatt 7 RHEINISCH- WESTFÄLISCHE TECHNISCHE HOCHSCHULE AACHEN LEHR- UND FORSCHUNGSGEBIET INFORMATIK II RWTH Aachen D-52056 Aachen GERMANY http://programmierung.informatik.rwth-aachen.de LuFG Informatik II Prof.

More information

Computer Science Introductory Course MSc - Introduction to Java

Computer Science Introductory Course MSc - Introduction to Java Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow

More information

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3 Notater: INF3331 Veronika Heimsbakk veronahe@student.matnat.uio.no December 4, 2013 Contents 1 Introduction 3 2 Bash 3 2.1 Variables.............................. 3 2.2 Loops...............................

More information

Scripting Languages Fast development, extensible programs

Scripting Languages Fast development, extensible programs Scripting Languages Fast development, extensible programs Devert Alexandre School of Software Engineering of USTC November 30, 2012 Slide 1/60 Table of Contents 1 Introduction 2 Dynamic languages A Python

More information

Introduction to Python

Introduction to Python Introduction to Python Luis Pedro Coelho luis@luispedro.org @luispedrocoelho European Molecular Biology Laboratory Lisbon Machine Learning School 2015 Luis Pedro Coelho (@luispedrocoelho) Introduction

More information

MiniMat: Matrix Language in OCaml LLVM

MiniMat: Matrix Language in OCaml LLVM Terence Lim - tl2735@columbia.edu August 17, 2016 Contents 1 Introduction 4 1.1 Goals........................................ 4 1.1.1 Flexible matrix notation......................... 4 1.1.2 Uncluttered................................

More information

Tasks of lexer. CISC 5920: Compiler Construction Chapter 2 Lexical Analysis. Tokens and lexemes. Buffering

Tasks of lexer. CISC 5920: Compiler Construction Chapter 2 Lexical Analysis. Tokens and lexemes. Buffering Tasks of lexer CISC 5920: Compiler Construction Chapter 2 Lexical Analysis Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Copyright Arthur G. Werschulz, 2017. All

More information

Lisp Introduction. Dr. Neil T. Dantam. Spring CSCI-498/598 RPM, Colorado School of Mines. Dantam (Mines CSCI, RPM) Lisp Spring / 88

Lisp Introduction. Dr. Neil T. Dantam. Spring CSCI-498/598 RPM, Colorado School of Mines. Dantam (Mines CSCI, RPM) Lisp Spring / 88 Lisp Introduction Dr. Neil T. Dantam CSCI-498/598 RPM, Colorado School of Mines Spring 28 Dantam (Mines CSCI, RPM) Lisp Spring 28 / 88 Outline Lisp Common Lisp by Example Implementation Details Typing

More information

Comp 11 Lectures. Mike Shah. June 20, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 20, / 38

Comp 11 Lectures. Mike Shah. June 20, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 20, / 38 Comp 11 Lectures Mike Shah Tufts University June 20, 2017 Mike Shah (Tufts University) Comp 11 Lectures June 20, 2017 1 / 38 Please do not distribute or host these slides without prior permission. Mike

More information

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work Lab 5 : Linking Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work 1 Objective The main objective of this lab is to experiment

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!

More information

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course.

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course. C PROGRAMMING 1 INTRODUCTION This is not a full c-programming course. It is not even a full 'Java to c' programming course. 2 LITTERATURE 3. 1 FOR C-PROGRAMMING The C Programming Language (Kernighan and

More information

Elementary Sorts 1 / 18

Elementary Sorts 1 / 18 Elementary Sorts 1 / 18 Outline 1 Rules of the Game 2 Selection Sort 3 Insertion Sort 4 Shell Sort 5 Visualizing Sorting Algorithms 6 Comparing Sorting Algorithms 2 / 18 Rules of the Game Sorting is the

More information

Introduction to Python and its unit testing framework

Introduction 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 information

Monte Carlo Simulations

Monte Carlo Simulations Monte Carlo Simulations 1 Homework 3: Optical Sim A little late, so I am making it easier than my original goal (still due this coming MONDAY, 9-26) Run my Ray Tracer program and determine what fraction

More information

CS 221 Lecture 9. Tuesday, 1 November 2011

CS 221 Lecture 9. Tuesday, 1 November 2011 CS 221 Lecture 9 Tuesday, 1 November 2011 Some slides in this lecture are from the publisher s slides for Engineering Computation: An Introduction Using MATLAB and Excel 2009 McGraw-Hill Today s Agenda

More information

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course Adam Blank Spring 2017 CSE 311 Foundations of Computing I * All slides are a combined effort between previous instructors of the course HW 3 De-Brief HW 3 De-Brief PROOFS! HW 3 De-Brief Proofs This is

More information

C++ For Science and Engineering Lecture 8

C++ For Science and Engineering Lecture 8 C++ For Science and Engineering Lecture 8 John Chrispell Tulane University Friday 10, 2010 Arrays Structures are ways of storing more than one type of information together. A structure is a vesatile data

More information

Blocking Synchronization: Streams Vijay Saraswat (Dec 10, 2012)

Blocking Synchronization: Streams Vijay Saraswat (Dec 10, 2012) 1 Streams Blocking Synchronization: Streams Vijay Saraswat (Dec 10, 2012) Streams provide a very simple abstraction for determinate parallel computation. The intuition for streams is already present in

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

CS187 - Science Gateway Seminar for CS and Math

CS187 - Science Gateway Seminar for CS and Math CS187 - Science Gateway Seminar for CS and Math Fall 2013 Class 3 Sep. 10, 2013 What is (not) Computer Science? Network and system administration? Playing video games? Learning to use software packages?

More information

Lexical Analysis: DFA Minimization & Wrap Up

Lexical Analysis: DFA Minimization & Wrap Up Lexical Analysis: DFA Minimization & Wrap Up Automating Scanner Construction PREVIOUSLY RE NFA (Thompson s construction) Build an NFA for each term Combine them with -moves NFA DFA (subset construction)

More information

Finite Automata and Formal Languages

Finite Automata and Formal Languages Finite Automata and Formal Languages TMV26/DIT32 LP4 2 Lecture 6 April 5th 2 Regular expressions (RE) are an algebraic way to denote languages. Given a RE R, it defines the language L(R). Actually, they

More information

ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University

ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University Prof. Mi Lu TA: Ehsan Rohani Laboratory Exercise #4 MIPS Assembly and Simulation

More information

CS 163/164 - Exam 1 Study Guide and Practice Exam

CS 163/164 - Exam 1 Study Guide and Practice Exam CS 163/164 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Strings...................................................

More information

Introduction to Programming (Java) 3/12

Introduction to Programming (Java) 3/12 Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

MI-RUB Exceptions Lecture 7

MI-RUB Exceptions Lecture 7 MI-RUB Exceptions Lecture 7 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 information

Modern Functional Programming and Actors With Scala and Akka

Modern Functional Programming and Actors With Scala and Akka Modern Functional Programming and Actors With Scala and Akka Aaron Kosmatin Computer Science Department San Jose State University San Jose, CA 95192 707-508-9143 akosmatin@gmail.com Abstract For many years,

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

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement: Mapping Reducibility 2017/11/16 Chapter 5.3 in Sipser Ø Announcement: q Slides for this lecture are here: http://www.public.asu.edu/~yzhan442/teaching/cse355/lectures/mapping.pdf 1 Last time Reducibility

More information

Introduction to Python

Introduction to Python Introduction to Python Luis Pedro Coelho Institute for Molecular Medicine (Lisbon) Lisbon Machine Learning School II Luis Pedro Coelho (IMM) Introduction to Python Lisbon Machine Learning School II (1

More information

Building Algorithmic Polytopes. David Bremner with D. Avis, H.R. Tiwary, and O. Watanabe December 16, 2014

Building Algorithmic Polytopes. David Bremner with D. Avis, H.R. Tiwary, and O. Watanabe December 16, 2014 Building Algorithmic Polytopes David Bremner with D. Avis, H.R. Tiwary, and O. Watanabe December 16, 2014 Outline Matchings in graphs Given G = (V, E), M E is called a matching {e M v e} 1 v V A matching

More information

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10 Merge Sort 1 / 10 Outline 1 Merging 2 Merge Sort 3 Complexity of Sorting 4 Merge Sort and Other Sorts 2 / 10 Merging Merge sort is based on a simple operation known as merging: combining two ordered arrays

More information

Take-home Lab 1. Arrays

Take-home Lab 1. Arrays Take-home Lab 1 Arrays Findx 2-Dimensional Array Graded! Submit by Friday 23:59 Find You are given a treasure map by your friend Map is divided into R by C cells Super Marks The Spot You need to find all

More information

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture. Turing Machines 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 machine

More information

Motivation. Dictionaries. Direct Addressing. CSE 680 Prof. Roger Crawfis

Motivation. Dictionaries. Direct Addressing. CSE 680 Prof. Roger Crawfis Motivation Introduction to Algorithms Hash Tables CSE 680 Prof. Roger Crawfis Arrays provide an indirect way to access a set. Many times we need an association between two sets, or a set of keys and associated

More information

More Example Using Loops

More Example Using Loops Loops and Repetitive Computations For More Example Using Loops Example 35 (contd) printing of first row print the first day i= i+1 no i < 7? yes printf("%6d", i) exit no i < =n? i = i+7 printf("\n") printing

More information

Program Verification Using Separation Logic

Program Verification Using Separation Logic Program Verification Using Separation Logic Cristiano Calcagno Adapted from material by Dino Distefano Lecture 1 Goal of the course Study Separation Logic having automatic verification in mind Learn how

More information

Jointly Learning Python Programming and Analytic Geometry

Jointly Learning Python Programming and Analytic Geometry Jointly Learning Python Programming and Analytic Geometry Cristina-Maria Păcurar Abstract The paper presents an original Python-based application that outlines the advantages of combining some elementary

More information

CSE 331 Software Design & Implementation

CSE 331 Software Design & Implementation CSE 331 Software Design & Implementation Kevin Zatloukal Summer 2017 Lecture 2 Reasoning About Code With Logic (Based on slides by Mike Ernst, Dan Grossman, David Notkin, Hal Perkins, Zach Tatlock) Recall

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

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion:

More information

Comp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33

Comp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33 Comp 11 Lectures Mike Shah Tufts University July 12, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 12, 2017 1 / 33 Please do not distribute or host these slides without prior permission. Mike

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

Denotational semantics

Denotational semantics Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.

More information

Compilers. Lexical analysis. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Lexical analysis. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Lecture 3 Lexical analysis Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Big picture Source code Front End IR Back End Machine code Errors Front end responsibilities Check

More information

Python. Tutorial. Jan Pöschko. March 22, Graz University of Technology

Python. Tutorial. Jan Pöschko. March 22, Graz University of Technology Tutorial Graz University of Technology March 22, 2010 Why? is: very readable easy to learn interpreted & interactive like a UNIX shell, only better object-oriented but not religious about it slower than

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

Structural Induction

Structural Induction Structural Induction In this lecture we ll extend the applicability of induction to many universes, ones where we can define certain kinds of objects by induction, in addition to proving their properties

More information

Reference counting:

Reference counting: Invariant: Reference counting: Reference counting: 2 0 3 2 0 2 2 0 2 2 2 2 2 white gray r r r black do not ;; init-allocator : -> void? (define (init-allocator) (for ([i (in-range 0 (heap-size))])

More information

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ;

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ; 1 Trees The next major set of data structures belongs to what s called Trees. They are called that, because if you try to visualize the structure, it kind of looks like a tree (root, branches, and leafs).

More information

An Introduction to MAGMA

An Introduction to MAGMA An Introduction to MAGMA Don Taylor The University of Sydney 13 February 2012 Don Taylor (The University of Sydney) Magma Programming 13 February 2012 1 / 31 A little history MAGMA is a programming language

More information

1 Java Night Countdown (30%)

1 Java Night Countdown (30%) Midterm Examination Problem Sheet TIME: 04/18/2009, 19:00 21:00 This is a open-textbook exam. You can use the Absolute Java textbook as your reference during the exam. Any other references are not allowed.

More information

CSE 311: Foundations of Computing. Lecture 26: Cardinality

CSE 311: Foundations of Computing. Lecture 26: Cardinality CSE 311: Foundations of Computing Lecture 26: Cardinality Cardinality and Computability Computers as we know them grew out of a desire to avoid bugs in mathematical reasoning A brief history of reasoning

More information

CS415 Compilers Syntax Analysis Top-down Parsing

CS415 Compilers Syntax Analysis Top-down Parsing CS415 Compilers Syntax Analysis Top-down Parsing These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Announcements Midterm on Thursday, March 13

More information

CAAM420: Week 3 Wednesday Notes

CAAM420: Week 3 Wednesday Notes CAAM420: Week 3 Wednesday Notes Justin DeVito 09/11/13 1 Overview of Homework 3 For an example function declaration: int rand ( ) int - return type rand - function name () - argument list (which can be

More information

Handling Encryption in an Analysis for Secure Information Flow

Handling Encryption in an Analysis for Secure Information Flow Handling Encryption in an Analysis for Secure Information Flow Peeter Laud peeter l@ut.ee Tartu Ülikool Cybernetica AS ESOP 2003, 7.-11.04.2003 p.1/15 Overview Some words about the overall approach. Definition

More information

Basic Java OOP 10/12/2015. Department of Computer Science & Information Engineering. National Taiwan University

Basic Java OOP 10/12/2015. Department of Computer Science & Information Engineering. National Taiwan University Basic Java OOP 10/12/2015 Hsuan-Tien Lin ( 林軒田 ) htlin@csie.ntu.edu.tw Department of Computer Science & Information Engineering National Taiwan University ( 國立台灣大學資訊工程系 ) Hsuan-Tien Lin (NTU CSIE) Basic

More information

Lecture 3: Finite Automata

Lecture 3: Finite Automata Administrivia Lecture 3: Finite Automata Everyone should now be registered electronically using the link on our webpage. If you haven t, do so today! I d like to have teams formed by next Monday at the

More information

Relative Hilbert-Post completeness for exceptions

Relative Hilbert-Post completeness for exceptions Relative Hilbert-Post completeness for exceptions Dominique Duval with J.-G. Dumas, B. Ekici, D. Pous, J.-C. Reynaud LJK University of Grenoble-Alpes and ENS Lyon November 12., 2015 MACIS 2015, Berlin

More information

Program Slicing. Author: Mark Weiser Published in TSE, Presented by Peeratham (Karn) Techapalokul 10/13/2015

Program Slicing. Author: Mark Weiser Published in TSE, Presented by Peeratham (Karn) Techapalokul 10/13/2015 Program Slicing Author: Mark Weiser Published in TSE, 1984 Presented by Peeratham (Karn) Techapalokul 1/13/215 About Mark Weiser a chief scientist at Xerox PARC Widely considered to be the father of ubiquitous

More information

PetriScript Reference Manual 1.0. Alexandre Hamez Xavier Renault

PetriScript Reference Manual 1.0. Alexandre Hamez Xavier Renault PetriScript Reference Manual.0 Alexandre Hamez Xavier Renault Contents PetriScript basics 3. Using PetriScript................................. 3.2 Generalities.................................... 4.3

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

Finite Automata Part Two

Finite Automata Part Two Finite Automata Part Two DFAs A DFA is a Deterministic Finite Automaton A DFA is defined relative to some alphabet Σ. For each state in the DFA, there must be exactly one transition defined for each symbol

More information

More on Methods and Encapsulation

More on Methods and Encapsulation More on Methods and Encapsulation Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 31, 2009 H.-T. Lin (NTU CSIE) More on Methods and Encapsulation OOP(even) 03/31/2009 0 / 38 Local Variables Local

More information

CS 7B - Spring Assignment: Adapting the calculator for bitwise expressions. due 2/21/18

CS 7B - Spring Assignment: Adapting the calculator for bitwise expressions. due 2/21/18 CS 7B - Spring 2018 - Assignment: Adapting the calculator for bitwise expressions. due 2/21/18 Background Theory A bitwise number is a number in base 2. In base 2, place values are either a 1 or 0, depending

More information

Compiling Techniques

Compiling Techniques Lecture 11: Introduction to 13 November 2015 Table of contents 1 Introduction Overview The Backend The Big Picture 2 Code Shape Overview Introduction Overview The Backend The Big Picture Source code FrontEnd

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky Based on slides Dr. M. P. Frank and Dr. J.L. Gross

More information

GRASS GIS Development APIs

GRASS GIS Development APIs GRASS GIS Development APIs Lifting the fog on the different ways to develop with and for GRASS Moritz Lennert Member of the GRASS GIS Project Steering Comittee PostGISomics Over 30 years of development

More information

Lecture 4: Proposition, Connectives and Truth Tables

Lecture 4: Proposition, Connectives and Truth Tables Discrete Mathematics (II) Spring 2017 Lecture 4: Proposition, Connectives and Truth Tables Lecturer: Yi Li 1 Overview In last lecture, we give a brief introduction to mathematical logic and then redefine

More information

More About Methods. Hsuan-Tien Lin. Deptartment of CSIE, NTU. OOP Class, March 8-9, 2010

More About Methods. Hsuan-Tien Lin. Deptartment of CSIE, NTU. OOP Class, March 8-9, 2010 More About Methods Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 8-9, 2010 H.-T. Lin (NTU CSIE) More About Methods OOP 03/08-09/2010 0 / 24 Methods: the Basic Method (1/2, Callee s View) 1 p

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

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Define and compute the cardinality of a set. Use functions to compare the sizes of sets. Classify sets

More information

The Arithmetic of Reasoning. Chessa Horomanski & Matt Corson

The Arithmetic of Reasoning. Chessa Horomanski & Matt Corson The Arithmetic of Reasoning LOGIC AND BOOLEAN ALGEBRA Chessa Horomanski & Matt Corson Computers Ask us questions, correct our grammar, calculate our taxes But Misunderstand what we re sure we told them,

More information

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages Homework s TM Variants and the Universal TM Homework #6 returned Homework #7 due today Homework #8 (the LAST homework!) Page 262 -- Exercise 10 (build with JFLAP) Page 270 -- Exercise 2 Page 282 -- Exercise

More information

PLC type system. if (x : t) 2 G. G ` x : t. G, x : t 1 ` M : t 2 G ` lx : t 1 (M) : t 1 t 2. if x /2 dom(g)

PLC type system. if (x : t) 2 G. G ` x : t. G, x : t 1 ` M : t 2 G ` lx : t 1 (M) : t 1 t 2. if x /2 dom(g) PLC type system (var) G ` x : t if (x : t) 2 G (fn) G, x : t 1 ` M : t 2 G ` lx : t 1 (M) : t 1 t 2 if x /2 dom(g) (app) G ` M : t 1 t 2 G ` M 0 : t 1 G ` MM 0 : t 2 (gen) G ` M : t G ` La (M) : 8a (t)

More information

Lecture 3: Finite Automata

Lecture 3: Finite Automata Administrivia Lecture 3: Finite Automata Everyone should now be registered electronically using the link on our webpage. If you haven t, do so today! I d like to have teams formed by next Wednesday at

More information

Decidability and Undecidability

Decidability and Undecidability Decidability and Undecidability Major Ideas from Last Time Every TM can be converted into a string representation of itself. The encoding of M is denoted M. The universal Turing machine U TM accepts an

More information

Administrivia. Test I during class on 10 March. Bottom-Up Parsing. Lecture An Introductory Example

Administrivia. Test I during class on 10 March. Bottom-Up Parsing. Lecture An Introductory Example Administrivia Test I during class on 10 March. Bottom-Up Parsing Lecture 11-12 From slides by G. Necula & R. Bodik) 2/20/08 Prof. Hilfinger CS14 Lecture 11 1 2/20/08 Prof. Hilfinger CS14 Lecture 11 2 Bottom-Up

More information

Computing via boolean logic. COS 116: 3/8/2011 Sanjeev Arora

Computing via boolean logic. COS 116: 3/8/2011 Sanjeev Arora Computing via boolean logic. COS 116: 3/8/2011 Sanjeev Arora Recap: Boolean Logic Example Ed goes to the party if Dan does not and Stella does. Choose Boolean variables for 3 events: { Each E: Ed goes

More information

Computability, Undeciability and the Halting Problem

Computability, Undeciability and the Halting Problem Computability, Undeciability and the Halting Problem 12/01/16 http://www.michael-hogg.co.uk/game_of_life.php Discrete Structures (CS 173) Lecture B Gul Agha 1 Based on slides by Derek Hoiem, University

More information

SO x is a cubed root of t

SO x is a cubed root of t 7.6nth Roots 1) What do we know about x because of the following equation x 3 = t? All in one.docx SO x is a cubed root of t 2) Definition of nth root: 3) Study example 1 4) Now try the following problem

More information

CS415 Compilers Syntax Analysis Bottom-up Parsing

CS415 Compilers Syntax Analysis Bottom-up Parsing CS415 Compilers Syntax Analysis Bottom-up Parsing These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Review: LR(k) Shift-reduce Parsing Shift reduce

More information

Numerical Methods - Preliminaries

Numerical Methods - Preliminaries Numerical Methods - Preliminaries Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Preliminaries 2013 1 / 58 Table of Contents 1 Introduction to Numerical Methods Numerical

More information

Lecture 4: Finite Automata

Lecture 4: Finite Automata Administrivia Lecture 4: Finite Automata Everyone should now be registered electronically using the link on our webpage. If you haven t, do so today! I dliketohaveteamsformedbyfriday,ifpossible,butnextmonday

More information

Anatomy of SINGULAR talk at p. 1

Anatomy of SINGULAR talk at p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011- p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011 - Hans Schönemann hannes@mathematik.uni-kl.de Department of Mathematics University of Kaiserslautern Anatomy

More information

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion: German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:

More information

Comp 11 Lectures. Dr. Mike Shah. August 9, Tufts University. Dr. Mike Shah (Tufts University) Comp 11 Lectures August 9, / 34

Comp 11 Lectures. Dr. Mike Shah. August 9, Tufts University. Dr. Mike Shah (Tufts University) Comp 11 Lectures August 9, / 34 Comp 11 Lectures Dr. Mike Shah Tufts University August 9, 2017 Dr. Mike Shah (Tufts University) Comp 11 Lectures August 9, 2017 1 / 34 Please do not distribute or host these slides without prior permission.

More information

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012

Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Finite Automata and Formal Languages TMV26/DIT32 LP4 22 Lecture 7 Ana Bove March 27th 22 Overview of today s lecture: Regular Expressions From FA to RE Regular Expressions Regular expressions (RE) are

More information

CS177 Fall Midterm 1. Wed 10/07 6:30p - 7:30p. There are 25 multiple choice questions. Each one is worth 4 points.

CS177 Fall Midterm 1. Wed 10/07 6:30p - 7:30p. There are 25 multiple choice questions. Each one is worth 4 points. CS177 Fall 2015 Midterm 1 Wed 10/07 6:30p - 7:30p There are 25 multiple choice questions. Each one is worth 4 points. Answer the questions on the bubble sheet given to you. Only the answers on the bubble

More information