CS164 Spring 2012 Lectures

1 Why Take CS164?
What is a programming language. Why you will write a few in your life. How you will learn language design skills in CS164.
slides: pptx pdf
screencasts (January 17, 2012): HD YouTube

2 The Google Calculator
Expressions, values, types. Their representation and interpretation. Running Example: Unit Conversion Calculator.
slides: pptx pdf
screencasts (January 19, 2012): HD YouTube

3 Growing a Language
Growing the Google Calculator. Scoping and Frames. Name binding. Syntax desugaring. Delaying evaluation with lambdas. If, while constructs.
slides: pptx pdf
screencasts (January 24, 2012): HD YouTube
slides are preliminary
homework: HW2: Desugaring (optional but highly recommended before you start desugaring in PA1)

4 Building Control Abstractions with Coroutines
Iterators, tables, comprehensions, coroutines, lazy iterators, composing iterators
screencasts (January 26, 2012): HD YouTube
reading before the lecture: Coroutines in Lua, Chapter 9 (required reading)
more reading before the lecture: More uses of coroutines (Sec 3)
assigned reading (required): Coroutines in Lua, Chapter 9 (required reading)

5 Implementing Coroutines
Bytecode compiler, bytecode interpreter, implementing asymmetric coroutines, language design issues.
slides: pptx pdf
screencasts (January 31, 2012): YouTube
homework: HW3: Use coroutines to build new abstractions

6 Logic Programming
Programming in Prolog
slides: pptx pdf
screencasts (February 02, 2012): HD YouTube
reading before the lecture: Prolog Tutorial (Ch 1-11)
assigned reading (required): Prolog Tutorial (Ch 1-11)

7 Implementing Prolog Interpreter
A simple Prolog interpreter on top of coroutines
slides: pptx pdf
screencasts (February 07, 2012): HD YouTube
assigned reading (required): Chapters 4,6 from The Art of Prolog

8 Parsing
A Prolog recursive descent parser. Observe this parser is in the Datalog language and can be evaluated without backtracking, yielding the CYK parser. Optimizing CYK with a magic-set transformation yields the Earley parser.
slides: pptx pdf
screencasts (February 09, 2012): HD YouTube
reading before the lecture: lecture from fa10
more reading before the lecture: Detailed explanation of Earley parser

9 Syntax Directed Translation
Earley parser. Grammar disambiguation. Parsing natural language. Hints for Earley Parser HW Contest.
slides: pptx pdf
screencasts (February 14, 2012): HD YouTube
reading before the lecture: Syntax directed translation (Ch. 5)
homework: HW4: Optimize Earley parser

10 Regular expressions
Compiling RE to automata. Regexes via coroutines. Semantic gotchas in differences between regular expressions and regexes.
slides: pptx pdf
screencasts (February 16, 2012): YouTube
reading before the lecture: Regular expressions from fa10

11 How to Implement Small Languages
Internal and external domain-specific languages. Taught as a review of material covered in first ten lectures.
slides: pptx pdf
screencasts (February 21, 2012): HD YouTube
assigned reading (required): rake: a make-like DSL in Ruby
homework: HW5: Regex Syntax Highlighting with jQuery

12 Small languages in the real world.
Ideas for your final project.
slides: pptx pdf
screencasts (February 23, 2012): HD YouTube
assigned reading (required): Protovis

13 Natural Language Processing with Syntax-Directed Translation
Translating simple natural language queries to Prolog and other formal languages
slides: pptx pdf
screencasts (February 28, 2012): HD YouTube
reading before the lecture: NL Interfaces to Databases

14 Data Abstraction
Several styles of object-oriented programming in Lua.
slides: pptx pdf
screencasts (March 01, 2012): HD YouTube
reading before the lecture: Chapter 16 in PiL
assigned reading (required): Chapter 16 in PiL

15 Static types for OO languages
Why Java is not fully statically typed language (static vs. dynamic checks). Subverting the execution when type checks are missing.
slides: pptx pdf
screencasts (March 08, 2012): HD YouTube
assigned reading (required): Notes on implementing objects efficiently; static vs dynamic checks for arrays; and exploits possible with weak type checks.

16 A Unification Type System.
The ML language.
slides: pptx pdf
screencasts (March 13, 2012): HD YouTube
homework: Problem set for L15,16,17

17 Flow Analysis
Analyzing types of objects with four lines of Prolog. Andersen's flow-insensitive points-to analysis. Datalog inference explained as parsing of a graph.
slides: pptx pdf
screencasts (March 15, 2012): YouTube

18 Inventing on Principle
Video guest lecture by Bret Victor
screencasts (March 20, 2012): YouTube
assigned reading (required): Up and Down the Ladder of Abstraction

19 Asynchronous Programming: Lifting Events with Arrows
Escaping the callback hell with reactive programming.
screencasts (March 22, 2012): YouTube
assigned reading (required): Read Sections 1 and 2 in the DSL 09 paper. Also read slides 1-39 in the Arrowlets slides, which are now attached as the official slides for Lecture 19.

20 Asynchronous Programming: Implementing Arrowlets
Continuation-passing style. Arrows composition operators.
slides: pptx pdf
screencasts (April 03, 2012): HD YouTube
assigned reading (required): Read Sections 3 to Section 4.1, plus the subsection on "repeat" in Section 4.2.

21 Asynchronous Programming with the Server: The RxJS Language
Duality between Push and Pull models (Iterable vs. Observable). Composing two asynchronous services.
slides: pptx pdf
screencasts (April 05, 2012): HD YouTube
no screencast on this day

22 Garbage Collection
Mark and Sweep, Stop and Copy, Reference Counting
slides: pptx pdf
screencasts (April 10, 2012):

23 no lecture
the topic will be covered on 4/17
screencasts (April 12, 2012):

24 Subverting a type system; Hiding an exploit in a compiler
(undermining) assumptions for type system safety; teaching a compiler, bootstrapping
slides: pptx pdf
screencasts (April 17, 2012): HD YouTube
assigned reading (required): Reflections on Trusting Trust


Course on program synthesis

Emina Torlak and I have given an invited tutorial at CAV 2012. The tutorial is being expanded this semester into a graduate course, which you can follow as we add lectures and homeworks. CAV tutorial slides: (ppt, pdf, screencast). The graduate course.

Postdoc position position in synthetic biology

We are looking for postdocs in synthetic biology. We need curious, well-rounded computer scientists with expertise in algorithms, hacking, and with interest in biology.

NSF Expedition in Computing for program synthesis

The multi-university ExCAPE project aims to change computer programming from the tedious task to one in which a programmer and an "automated program synthesis tool" collaborate to generate software that meets its specifications.

Looking for a postdoc position?

We are looking for postdocs in program synthesis and computer-aided programming.

2nd Dagstuhl Seminar in Program Synthesis

Several communities related to synthesis of programs and other computational artifacts will meet again in wine cellars of the castle.

Layout based on BASIC by Download Website Templates