On this page:
DSSL2:   Data Structures Student Language
8.12

DSSL2: Data Structures Student Language🔗ℹ

Jesse A. Tov <jesse@cs.northwestern.edu>
and Vincent St-Amour <stamourv@cs.northwestern.edu>

 #lang dssl2 package: dssl2

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:

#lang dssl2
 
struct node:
    let key
    let left
    let right
 
def insert(t, k):
    if t is None:
        t = node(k, None, None)
    elif k < t.key:
        t.left = insert(t.left, k)
    elif k > t.key:
        t.right = insert(t.right, k)
    return t
 
let t1 = insert(None, 1)
let t2 = insert(t1, 2)
let t3 = insert(t2, 3)

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):

Nonetheless, students familiar with Python should feel at home in DSSL2. And students learning DSSL2 should have a head start when learning Python.