CS 442: High Productivity and Performance with Domain Specific Languages in Scala

Spring 2011

Handouts | Assignments | Final Project | Grading policy | References | Collaboration policy
Logistics: Contact: Teaching Assistants: Instructor
Units: 3
T/Th 11:00am - 12:15pm
Gates 359
Staff mailing list
Scala mailing list
Hassan Chafi
Arvind Sujeeth
Kevin Brown
Kunle Olukotun


This course is an advanced undergraduate/graduate level introduction to developing domain specific languages (DSLs) for productivity and performance using the Scala programming language. The goal of this course is to equip students with the knowledge and tools to develop DSLs that can dramatically improve the experience of using high performance computation in important scientific and engineering domains. The course is aimed at two sorts of students: domain experts who can define key domain specific language elements that capture domain knowledge and computer scientists who can implement these DSLs using a new DSL framework in Scala. In the first half of the class we will focus on understanding the infrastructure for implementing DSLs in Scala and developing techniques for defining good DSLs. In the second half of the course we will focus on example DSLs that provide both high-productivity and performance. During the second half of the course groups of students will develop and implement their own DSLs using the Delite DSL infrastructure. Delite is a Scala infrastructure that simplifies the process of implementing DSLs for parallel computation.


CS background: CS108, and a systems course (CS143, CS140), preferably CS 149. Non CS background: Expertise in a particular domain and desire to improve productivity and performance of computation.


  1. Syllabus
  2. Language Virtualization for Heterogeneous Parallel Computing (Onward! 2010 paper)
  3. Delite GitHub repository
  4. Delite documentation and Getting Started guide
  5. scala-virtualized binary distribution

Code samples

  1. Lightweight Modular Staging


You are expected to participate in the class discussion; in fact, 10% of your grade depends on it. To facilitate discussion, I will call upon you at any time during a lecture to answer questions.


Date Topic Lecturer Assigned Due
Tue Mar 29Intro to DSLsKunle
Thu Mar 31Intro to ScalaHassanScala PA, Final Project
Tue Apr 5Scala II (OO, functional)Hassan
Thu Apr 7Scala III (advanced topics)Hassan
Tue Apr 12Lightweight Modular Staging in ScalaArvind
Thu Apr 14DeliteKevinDelite PAScala PA
Tue Apr 19OptiMLArvindFP proposal
Thu Apr 21Designing DSLsZach DeVito
Tue Apr 26Phantom Midterm
Thu Apr 28Phantom MidtermDelite PA
Tue May 3Course feedback and project discussionKunleFP proposal
Thu May 5DSLs for visualizationJeff Heer
Tue May 10LisztNiels Joubert
Thu May 12Scala STMNathan Bronson
Tue May 17DSLs for graphsSungpack
Thu May 19DSLs for data queryingHassan
Tue May 24Rogue: A Scala DSL for MongoDBJorge Ortiz
Thu May 26Presentations
Tue May 31Presentations / wrap upFinal project


  1. Scala Programming (code)
  2. Building a DSL

Final Project

The Final Project is an open-ended research project. The final project will be completed by groups of two to three students. The project will consist of defining a new DSL or adapting an existing DSL and implementing the DSL using Delite. The goal will be to demonstrate that using the DSL improves both productivity and performance. We encourage you to propose your own project, and also provide a few ideas here.

Grading policy

10% participation
20% programming assignments
70% final project


Collaboration policy

You are encouraged to discuss their ideas with others. However, you should work on your programs independently and hand in original code. If you receive significant help from others, you should attribute them when handing in your assignments.

Class Mailing List

Signing up for the class on Axess will automatically subscribe you to the class mailing list. Please make sure to do so as soon as possible.

Scala Version

The class will use two versions of the Scala compiler. The first programming assignment will use the Scala 2.8.1-final release of the language. It can be obtained from: http://www.scala-lang.org/ Instructions on how to install Scala will be included with the assignment. The second assignment and final project will use the scala-virtualized compiler that is being developed at EPFL in collaboration with the PPL specifically for embedding domain-specific languages in Scala. Scala-virtualized can be downloaded from github. We will provide a detailed getting started guide later in the quarter to help you get the environment up and running.

Scala Days Conference

On June 2-3 the second Scala Days conference will be held here at Stanford. Those of you who are or become passionate about Scala may wish to look into attending. More information about the conference is available at the Scala Days 2011 site. This is a fantastic opportunity to meet many of the people in the Scala community, including Prof. Martin Odersky.