Hello, world!

Who am I?

Tristan Knoth

  • PhD Candidate (advisor: Nadia Polikarpova)
  • Undergrad at Grinnell College

Interests

Research:

  • Advanced type systems: how to prove that a program does the right thing?
  • Program Synthesis: how to generate a program that does the right thing?









The Crew

Teaching assistants:

  • Aidan Denlinger
  • Bhavya Singh

Tutors

  • Justin Du
  • Eugene Lau
  • Melody Ruth
  • Danica Xiong









Lecture Format

In-person only (unless there are extenuating circumstances, in which case I’ll figure something out…)

  • There should be a podcast

Discussion sections:

  • In-person, PCYNH 106, Weds 7pm













A Programming Language

Two Variables

  • x, y

Three Operations

  • x++
  • x--
  • x = 0 ? L1 : L2







Example Program

(What does it do?)

L1: x++
    y--
    y = 0 ? L2 : L1
L2: ...







The above language is “equivalent to” every PL!

(See wikipedia)

But good luck writing

  • QuickSort
  • Fortnite
  • Spotify


Two lessons:

  • All Programming Languages share something fundamental
  • But also: your Programming Language shapes your Programming Thought











What is CSE 130 not about?

Learning…

  • JavaScript in March
  • Haskell in April
  • C++ in May
  • etc.

New languages come (and go …)

There was no

  • Python 35 years ago
  • Java 30 years ago
  • C# 25 years ago
  • Rust 12 years ago
  • WebAssembly 5 years ago







What is CSE 130 about?

  • Concepts in programming languages
  • Language design and implementation







If you don’t trust me, ask PL Twitter!

Two schools

Two schools







Course Goals

130 Brain

130 Brain

Free Your Mind.







Goal: Learn the Anatomy of PL

Anatomy

Anatomy

  • What makes a programming language?
  • Which features are fundamental and which are syntactic sugar?







Goal: Learn New Languages / Constructs

Musical Score

Musical Score

New ways to describe and organize computation, to create programs that are:

  • Correct
  • Readable
  • Extendable
  • Reusable







Goal: How to Design new Languages

New hot languages being designed in industry as we speak:

  • Hack, Flow, React @ Facebook
  • Rust @ Mozilla (now The Rust Foundation)
  • TypeScript @ Microsoft
  • Swift @ Apple
  • WebAsssembly @ Google + Mozilla + Microsoft

Buried in every large system is a (domain-specific) language

  • DB: SQL
  • Word, Excel: Formulas, Macros, VBScript
  • Emacs: LISP
  • Latex, shell scripts, build scripts (makefiles), …

If you work on a large system, you will design a new PL!







Course Syllabus

  • Lambda calculus (2 weeks)
    • The simplest language on Earth
  • Haskell (5 weeks)
    • A cool functional language
  • Build your own language (3 weeks)
    • How do we implement a new language (in Haksell)?
    • How do we formalize a language and prove things about it?







QuickSort in C

void sort(int arr[], int beg, int end){
  if (end > beg + 1){
    int piv = arr[beg];
    int l = beg + 1;
    int r = end;
    while (l != r-1)
       if(arr[l] <= piv) l++;
       else swap(&arr[l], &arr[r--]);
    if(arr[l]<=piv && arr[r]<=piv)
       l=r+1;
    else if(arr[l]<=piv && arr[r]>piv)
       {l++; r--;}
    else if (arr[l]>piv && arr[r]<=piv)
       swap(&arr[l++], &arr[r--]);
    else r=l-1;
    swap(&arr[r--], &arr[beg]);
    sort(arr, beg, r);
    sort(arr, l, end);
  }
}







QuickSort in Haskell

sort []     = []
sort (x:xs) = sort ls ++ [x] ++ sort rs
  where
    ls      = [ l | l <- xs, l <= x ]
    rs      = [ r | r <- xs, x <  r ]

(not a wholly fair comparison…)



















Course Logistics

  • webpage
    • calendar, lecture notes, programming assignments, …
  • piazza
    • announcements and discussions
  • gradescope
    • homework/exam submissions, grades
  • canvas
    • only be used to upload media (should we need it)







Grading

  • 45% Homework assignments
  • 25% Midterm
  • 30% Final
  • 05% Extra credit for Piazza discussion
    • To top 20 best participants







Assignments

  • 6 programming assignments
  • Released online, at least a week before due date
  • Due on Wednesday at 11:59pm
    • no assignment Weeks 1 and 2
  • 8 late days, no more than 4 late days per assignment
    • used atomically (5 mins late = 1 late day)
  • Submitted via Gradescope
    • submission instructions in the assignment
  • Solve alone or in groups of two
    • user the pinned piazza thread to find a partner







Exams

  • Midterm on October 28
    • Gradescope multiple choice
    • individual
    • 24h timespan
  • Final: December 7
    • programming assignment
    • individual
    • 24h timespan
  • Formats subject to change!
  • You can use any general resources you want (class material, Wikipedia), but do not:
    • search or post Chegg etc
    • post on StackOverflow etc
    • try to find past exams that are not publicly posted
    • communicate with each other during the exam
  • The final is cumulative
  • Midterm grade is calculated as midterm > 0 ? max(final, midterm) : 0
    • you get a second chance if you don’t do well on the midterm
    • you must turn in both the midterm and the final







In-class Quizzes

We will do quizzes in class via iClickers (remotes and app)

  • Make class interactive
  • Help you and me understand what’s tricky

Protocol

  1. Discuss
    • I show the quiz on screen
    • If in class: discuss with your neighbor
    • If remote: discuss with a friend on zoom chat (or any other chat)
    • Try to reach consensus
  2. Vote
    • Using iClicker remote or app
  3. Class Discuss
    • What was easy or tricky?







TEST QUIZ

How can you earn 5% extra credit for this class?

  • A do all my homework alone

  • B answers other students’ questions on Piazza

  • C submit all my homework on due date (without using late days)

  • D post snarky comments on zoom chat during lecture







Your Resources

  • Discussion section: Weds 7pm
    • PCYNH 106
  • Office hours
    • every day, check calendar
  • Piazza
    • we answer during work hours
  • No textbook
    • online lecture notes and links







Academic Integrity

Programming assignments: do not copy from classmates or from previous years

Exams done alone

  • Zero Tolerance
  • Offenders punished ruthlessly
  • Please see academic integrity statement







Students with Disabilites

Students requesting accommodations for this course due to a disability or current functional limitation must provide a current Authorization for Accommodation (AFA) letter issued by the Office for Students with Disabilities (OSD).

Students are required to present their AFA letters to Faculty (please make arrangements to contact me privately) and to the CSE OSD Liaison in advance so that accommodations may be arranged.







Diversity and Inclusion

Goal

  • Create a diverse and inclusive learning environment
  • Where all students feel comfortable and can thrive
  • If there is a way we can make you feel more included, please let one of the course staff know

Expectations

  • We expect that you will honor and respect your classmates
  • Abide by the UCSD Principles of Community
  • Understand that others’ backgrounds, perspectives and experiences may be different than your own
  • Help us to build an environment where everyone is respected and feels comfortable.

If you experience any sort of harassment or discrimination, please contact the Office of Prevention of Harassment and Discrimination. Students may receive confidential assistance at the Sexual Assault Resource Center at (858) 534-5793 or Counseling and Psychological Services (CAPS) at (858) 534-3755.







Feedback?

I want to get better at this!

You can give me constructive feedback and I will try to improve.

Link is on the class website as well.