30
CSE 505 Programming Languages Intro 1

CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

CSE 505Programming Languages

Intro1

Page 2: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

2

Page 3: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Hello! My name is...Zach Tatlockztatlock@csCSE 546

door is open!

New faculty first ever course!)

3

Page 4: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

ResourcesWeb: http://courses.cs.washington.edu/

courses/cse505/13au/

Mailing List: [email protected]

Piazza: (your course email will be subscribed)

4

Page 5: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Structure4-5 Individual Homeworks:

- “pen & paper” (TeX) proofs- implementations in OCaml- challenge problems optional

Midterm & Final

Useful, Optional ReferencePierce’s Types and Programming Languages

5

Page 6: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

6

Page 7: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Academic IntegrityDo. Not. Cheat.

Erodes the very foundation of academia.Absolutely not worth the risk.

Roughly: Discuss problem and sketch ideas together.Write your own solutions, note discussion partners.

When in doubt, ask!

7

Page 8: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

8

Page 9: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

9

Page 10: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

10

Page 11: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

11

Page 12: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

SOFTWAREIS

GREAT!!!

12

Page 13: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

The magic of myth and legend has been realized in our time. One simply types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.

Fred Brooks

13

Page 14: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

http://cs.brown.edu/events/talks/notkin.html

14

Page 15: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

SOFTWAREIS GREAT!!!

... but (often) still poorly understood!

15

Page 16: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

wat

https://www.destroyallsoftware.com/talks/wat

16

Page 17: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Room For ImprovementDevelopment

quickly produce high quality code in teams

Maintenancecomprehend, extend, fix bugs, tune

Reliabilityavionics, medicine, finance, nuclear power

Require reasoning!17

Page 18: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

What do these do?

printf("%d", printf("%d", printf("%d", printf("%s", "husky"))));

a=0?(3>2?23:(2>5?(7<6?34:48):64)):1;printf("%d",a);

Realistic?

18

Page 19: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Safe to optimize / refactor?class A { int f() { return 0; } }class B { int g(A x) { try { return x.f(); } finally { foo(); } }}

class A { int f() { return 0; } }class B { int g(A x) { return 0; }}

)19

Page 20: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

... nope.A could be extendedx could be nulls could have “side effects”

Safe to optimize / refactor?

How can we handle general case?How can we be sure it’s right?How do we automate?

20

Page 21: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Goal

Develop tools to rigorously study what programs mean.

semantics

equivalence, termination, determinism, ...

21

Page 22: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

... [rigorous proofs about programs] are an absolute scientific ideal, like purity of materials in chemistry or accuracy of measurement in mechanics. The value of purity and accuracy (just like correctness) are often not appreciated until after the scientist has built the tools that make them achievable.

Sir C.A.R. Hoare

our goal is noble!

22

Page 23: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Benefits

Writing a PL-ish thing is inevitableextensible systems, rich data structures, optimizer

Build skill with “Theory B” formalismsall research needs precision, expressiveness, clarity

Become better programmerstravel to understand where you’re from

23

Page 24: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

24

Page 25: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

25

Page 26: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Which PL to Study?Well... which is the best?Aren’t they all the same?

Depends.Yes and no.

Challenges?

26

Page 27: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Approach

Define small, tractable languagesTuring complete, but not for “real” programming

Extend with increasingly rich featuresextend reasoning techniques in parallel

Sketch application to “real” PLsimplement programs to connect theory with code

10 weeks is short!

27

Page 28: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Subgoals

Develop tools for studying program behaviorinductive defns, structural induction, inference rules

Investigate core PL conceptstypes, functions, scope, mutation, iteration

28

Page 29: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

29

Page 30: CSE 505 Programming Languages - courses.cs.washington.educourses.cs.washington.edu/courses/cse505/13au/lec-01-intro-1up.pdf · Hello! My name is... Zach Tatlock ztatlock@cs CSE 546

Today: IntroductionAdministrivia

Motivation and Goals

Overview

Caml Crash Course

30