CSE 402: Design and Implementation of Domain-Specific Languages Winter 2020, MWF 8:30am-9:20am, CSE2 G001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Why domain-specific languagesNo revolution in computing occurred the help from a programming language. For example, Unix was implemented with C, databases were programmed with SQL, and the Web was built on JavaScript. Programming languages help programmers by placing a layer of abstraction above the messy hardware. Languages are most effective when they are tailored to a programming task:
We call such specialized languages domain-specific, and we often choose them over general-purpose languages because they are easier to use or because their programs run faster, or both. It's hard to find an area of computing that doesn't critically rely on a DSL or two. You will find DSLs in
Some DSLs are compiled, others come with an interpreter, while others are implemented as libraries, frameworks, or marketed as an API. No matter what their implementation, all DSLs have in common that they offer the programmer convenient programming constructs tailored to the domain. What you will learnYou will learn how to design and implement a domain-specific language. We will cover several strategies for implementing a DSL, and practice most of them in programming assignments. All told, you will implement a compiler, an interpreter, a parser, and an optimizer. Like CSE401, this course is unique because it spans from foundations to their applications. In other words, you will learn about beautiful algorithms and apply them in programming assignments. The course material is split into five thematic parts, each describing some DSL technology. The lectures and homework are motivated by a real-world application. For example, optimization (Part 2) is motivated by query processing, and parsing (part 3) is motivated by templating, which is the process of translating a data set into a formatted document. While the programming assignments will focus on the domain-specific languages, you will learn principles useful in implementing a traditional compiler (for example, you will learn how to use the ANTLR parser). Students interested in a course project that implements a general-purpose compiler should consider taking CSE401, typically taught by Prof. Perkins. Please note that students are allowed to take both CSE401 and CSE402. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Course formatLectures and sections: The course will have three lectures per week. You will practice the material in recitation sections and in programming homeworks. Exams: Instead of the two midterms, we will give four shorter in-class quizzes. There will be roughly one quiz for each of the five thematic parts of the course. We will distribute practice questions from past quizzes. Homeworks: Five programming homeworks will help you understand the material and acquire the skills needed for the final project. Except for the first homework, you will work on your homework in groups. The final project: You will acquire the hands-on skills of designing a DSL in a group project. You will implement a language based on your own design, or based on a design offered by the course staff. (See the gallery of past projects.) You will present your project in a demo/poster session, which replaces the final exam.
Late days: you can have up to three late days on homeworks HW2 to HW4. There is a 15% penalty for each additional late day. There are no late days on HW5 (the final project). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Syllabus and lecture materialsThe following syllabus is preliminary. We will fine tune the schedule add add links to Winter 2020 slides as the course progresses. You can always download the up-to-date slides from these Dropbox folders: 20wi, 19sp. Part I: Implementation Strategies / Regular Expressions (problem set)
Jan 8: cancelled
Jan 10: designing DSL abstractions (assigned reading)
Part II: Optimizations / Query Languages (problem set) Jan 13: cancelled (winter storm) Jan 16: Constructing and optimizing ASTs
Jan 17: Section 2: Optimizing ASTs, Homework 2 information
Part III: Parsing / Templating (problem set and past quizzes)
Part IV: Reactive Languages, Laziness / Working with Data (problems)
Part V: Types and Objects, Garbage Collection, Staging (problems)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SectionsTwo sections are offered: Here you will find links to section materials. You need to log in with your UW CSE google id (not your UW id). Currently, the section topics are
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Homeworks and the final projectThere will be four programming homeworks. The first one will be individual, while the rest will be done in pairs. The final project is also known as the “fifth homework”. You will design and implement a small language of your choice. Typically, this design will extend the four homeworks. The homework handouts for HW1--4 will be “live” google docs on which students can ask clarification questions by adding comments to the text. The discussion about the homework will thus take place in the doc, not on Piazza. Use your <username>@cs.washington.edu google login to get to these documents.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exams and key datesInstead of midterms, we will test your knowledge with four quizzes. They will be 25-minutes long and will be held during lectures. Quizzes will be given about a week after the relevant HW is due. You should use this week to work on your problem sets and review the feedback for your HW. The poster and demo session will replace the final exam and will be held during the assigned final exam slot (Tuesday March 17, 8:30-10:20am). Location: The lecture room (CSE2 G001). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Recommended BooksThese five books are available on reserve for you in the Engineering Library: JavaScript, the good parts JavaScript, the Definitive Guide
Mastering Regular Expressions
The Definitive ANTLR 4 Reference
Programming in Lua
These online resources will also be useful: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Where to ask questions?Questions about lectures? Ask them on the Piazza 402 page. Questions about homeworks: Add comments to the handout docs. Questions on anything else: Also on Piazza. A private message to the instructors: Send it via Piazza. Any of the above: Come to our office hours. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Where are 402 announcements?You can find all announcements on Piazza, in the Piazza tab called Resources / Course Information. Check that page often or subscribe to email notifications from piazza. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The course staff and office hours
Email: krzysd@cs.washington.edu Office hours: Wednesday, 1:30 PM - 2:30 PM, CSE2 150 Office hours also available by appointment | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Academic MisconductThis course follows the Allen School academic misconduct rules. Students are expected to be familiar with these rules and principles, and follow them. |