Jesse A. Tov <jesse@cs.northwestern.edu>
and Vincent St-Amour <stamourv@cs.northwestern.edu>
DSSL2 is a programming language for data structures students. It’s designed to be simple, providing the essential building blocks one needs to implement a variety of data structures, but leaving out the finished products for students to build themselves.
DSSL2 is a close cousin of Python, with a similar indentation-sensitive syntax and similar function and keyword names when possible. For example, this is a DSSL2 program:
let keylet leftlet rightreturn t
Like Python, DSSL2 uses alignment and indentation to delimit blocks. In particular, compound statements such as def or if -elif -else take ⟨block ⟩s for each condition, where a ⟨block ⟩ can be either one simple statement followed by a newline, or a sequence of statements on subsequent lines that are all indented by four additional spaces. Extraneous indentation is an error.
DSSL2 deviates from Python in a number of places for pedagogical reasons. Some of these deviations include (non-exhaustive list):
the base data structures: replaced instead by basic arrays and structs
the object system: which emphasizes encapsulation and interfaces
variable declarations: to avoid Python’s scope gotchas.
Nonetheless, students familiar with Python should feel at home in DSSL2. And students learning DSSL2 should have a head start when learning Python.