Languages and Compilers Nate Nystrom Amanj Sherwany usi-compilers@googlegroups.com http://usi-pl.github.io/lc/sp2015 University of Lugano
About me 2009 2010 Assistant Professor 1998 1999 compiler engineer 1991 1995 BS CS, Math 1996 1998 MS CS 1999 2006 PhD CS 2006 2009 PL/SE group 2011 present Assistant Professor Purdue HP Cornell IBM TX Lugano 2
My research Using programming languages to solve systems problems Extensibility Polyglot, an extensible compiler framework http://www.cs.cornell.edu/projects/polyglot A framework for Scala compiler plugins Languages for safe kernel extensions Languages for systems programming on the JVM Concurrency and distribution and fault tolerance X10, a concurrent OO language for HPC http://www.x10-lang.org Firepile, a Scala library for GPU programming Languages for reasoning about relaxed consistency 3
Books We will have readings from Learn You a Haskell. It is available free online. We will not follow the other books, but they may be useful for reference 4
Grading Homework 20% Midterm exam 40% Final exam 40% 5
Late policy Time late Multiplier 5 minutes 100% 1 hour 90% 24 hours 50% > 24 hours 0% If you need more time, ask in advance 6
Academic Honesty You are free to discuss assignments and solutions. You must write your own assignments. Do not represent any portion of others' work as your own. Say with whom you worked. Cite any outside sources. Assignments found to have been plagiarized will be given a grade of 100%. 7
If you need help Get help early! Talk to each other: post on the forum Talk to Amanj: room 205. Talk to me: room 203. If it is a private matter, email us: usi-compilers@googlegroups.com 8
Assignments About one homework every week. More frequently in the beginning. Some writing. Some math. Some programming. 9
Website http://usi-pl.github.io/lc/sp-2015 Everything will be posted there. 10
Moodle Exists. 11
Community Forums: This is for course announcements and public questions. We need one. What do you guys want to use? Questions for the staff: usi-compilers@googlegroups.com 12
What do you want to get out of this course?
About you What is your name? Where are you from? What do you hope to get out of this class? 14
What do we want you to get out of this course?
Goals Become familiar with different programming paradigms Understand principles behind programming languages Understand how programming languages are implemented 16
Goals Become familiar with different programming paradigms Understand principles behind programming languages Understand how programming languages are implemented 17
Different paradigms We ll look at several different programming languages and try to distill them to their essential features We ll also look at how those features interact e.g., parametric polymorphism + subtyping = WTF!? But, we ll program primarily in Haskell 18
Why Haskell?
Get out of your comfort zone 20
Learning zone 21
Panic zone 22
Why Haskell? Haskell is a pure functional language No assignment, no loops You have to think differently about programs Haskell is lazy Think about computation as function composition, not as a sequence of instructions 23
Haskell crash course Wednesday Bring your computers 24
What do I want you to get out of this course? Become familiar with different programming paradigms Understand principles behind programming languages Understand how programming languages are implemented 25
PL principles We ll look at features common across multiple languages Focus is on semantics (what do programs mean?) (Mostly) ignore syntax (what do programs look like?) 26
Dynamic semantics How does a program behave? How is a program evaluated? We ll experiment with different semantics by implementing interpreters 27
What does this expression do? 1 + 2 28
Static semantics Restrictions on programs to provide (some) correctness guarantees e.g., if this program type checks, it won t crash Focus on type systems Some other formal methods (e.g., program verification) are covered in other classes 29
What do I want you to get out of this course? Become familiar with different programming paradigms Understand principles behind programming languages Understand how programming languages are implemented 30
Language implementation We ll implement interpreters We ll implement compilers We ll implement language runtime systems 31
Coming up Haskell and functional programming Parsing Interpreters and language semantics Compilers 32
Homework for Wednesday Do Assignment 0. It s posted on the course website. It s easy. Install ghc (the Glasgow Haskell Compiler) 7.8 or later http://haskell.org Mac users: brew install ghc haskell-platform port install ghc 33