CSE 341 : Programming Languages� �Lecture 1��Hello ML!
Zach Tatlock
Spring 2015
Hello! My name is…
Zach Tatlock
ztatlock@cs
CSE 546
3
4
I really like studying programming languages.
Super stoked to explore PL with all of you.
5
We shape our tools and thereafter
our tools shape us.
I discover that I think in words. The more words I know, the more things I can think about...
Reading was illegal because if you limit someone's vocab, you limit their thoughts. They can't even think of freedom because they don't have the language to.
Marshall McLuhan
M. K. Asante
6
I really like studying programming languages.
Why?
Super stoked to explore PL with all of you.
PL helps us break free to think thoughts, ask questions, and solve problems that would otherwise be inaccessible.
Welcome!
We have 10 short weeks to learn the fundamental concepts of PL.
Curiosity and persistence will get you everywhere.
We’ll become better programmers:
Today’s class:
7
Concise to-do list
In the next 24-48 hours:
8
http://www.cs.washington.edu/education/courses/cse341/15sp/
Our Incredible Guides
9
Max
super ultra helpful, extraordinarily smart, stellar smiles
Gur
Riley
Stuart
Our Guide in Spirit
10
Dan Grossman
Creator of this flavor of 341.
(spiritual guide?)
Staying in touch
11
Lecture:
12
Section
Material often also covered in reading notes / videos
13
Reading Notes and Videos
14
Textbooks, or lack thereof
15
Office hours
16
Homework
Only (2) is graded, but focusing on (2) makes homework harder
17
HEADS UP: Homeworks are terse!
18
19
Academic Integrity
20
Exams
21
Coursera Doppelgänger
22
Questions?
Anything I forgot about course mechanics before we discuss, you know, programming languages?
23
What this course is about
24
Why learn this?
25
To free our minds from the shackles of imperative programming.
A strange environment
26
Mindset
27
A very simple ML program
[The same program we just wrote in Vim; here for review]
28
(* My first ML program *)
val x = 34;
val y = 17;
val z = (x + y) + (y + 2);
val q = z + 1;
val abs_of_z = if z < 0 then 0 – z else z;
val abs_of_z_simpler = abs z
A variable binding
29
val z = (x + y) + (y + 2); (* comment *)
More generally:
val x = e;
The semantics
So what is the precise syntax, type-checking rules, and evaluation rules for various expressions? Good question!
30
ML, carefully, so far
31
Expressions
34 true false x e1+e2 e1<e2
if e1 then e2 else e3
32
Variables
sequence of letters, digits, _, not starting with digit
Look up type in current static environment
Look up value in current dynamic environment
33
Addition
e1 + e2 where e1 and e2 are expressions
If e1 and e2 have type int,
then e1 + e2 has type int
If e1 evaluates to v1 and e2 evaluates to v2,
then e1 + e2 evaluates to sum of v1 and v2
34
Values
35
Slightly tougher ones
What are the syntax, typing rules, and evaluation rules for conditional expressions?
What are the syntax, typing rules, and evaluation rules for
less-than expressions?
36
The foundation we need
We have many more types, expression forms, and binding forms to learn before we can write “anything interesting”
Syntax, typing rules, evaluation rules will guide us the whole way!
HW 1: functions, pairs, conditionals, lists, options, local bindings
Will not add (or need):
37