Skip to main content
A lecture theatre reduced to flat gold and black shapes, rows of seats sweeping past the frame, in a two-ink risograph print

SLOP6753: Implementing SNOBOL4

A twelve-week compiler-construction studio built around a single 1962 language, SNOBOL4, and the backtracking pattern-matching engine that made it strange. You write the whole thing yourself, in OCaml, one incremental submission at a time.

What you will do

You will build a working compiler front end and a genuinely backtracking pattern-matching engine for SNOBOL4, a 1962 Bell Labs language, in OCaml — by hand, in four incremental stages, each one a real codebase you download and complete rather than a toy exercise. Every checkpoint hands you a partially-implemented interpreter (the previous stage's working solution, with exactly this week's new feature stubbed out) and a genuine captured transcript of what the finished version prints, so "done" is never a matter of opinion. By week 9 your own interpreter runs real SNOBOL4 programs that concatenate, alternate, and backtrack over patterns correctly; by week 12 it does something none of your classmates' necessarily do, because the final project is a self-chosen extension you build, measure, and write up honestly.

Who it is for

This is a postgraduate compiler-construction studio, not an introduction to programming. You should already be comfortable reading and writing recursive data types and pattern matching in an ML-family language, or willing to pick that up fast in week 1 — the studios assume you can debug your own `match` exhaustiveness errors with a tutor's help, not that someone will explain what a variant type is. No prior exposure to SNOBOL4 itself is expected; almost nobody has any. What matters is a willingness to sit with a genuinely strange, fifty-year-old design decision — success and failure as the only control-flow primitive, patterns as data instead of syntax — long enough to see why it was made, rather than reaching immediately for how a modern language would do it instead.

The four movements

Twelve teaching weeks are organised into four movements, each ending at a graded checkpoint. Movements I and II build the scaffolding; Movement III is where the actual pattern engine gets written; Movement IV asks what a dynamically-typed value is, once patterns are one more entry on that list, and closes with a project of your own design.

Movement I · weeks 1–4

A Calculator That Talks Back

A lexer, a parser, and a tree-walking evaluator for integer and string literals, arithmetic, variables, and concatenation. Small enough to finish in four weeks, load-bearing enough that everything after it sits on top of it rather than beside it.

Checkpoint 1 — due 19 March 2027 (20%)

Movement II · weeks 5–6

Programs That Can Fail

Success and failure become the language's only branching primitive — no if, no while, no for. The goto field turns the expression evaluator into a statement executor, and DEFINE adds functions built from ordinary call frames, not new syntax.

Checkpoint 2 — due 2 April 2027 (20%)

Movement III · weeks 7–9

The Engine Underneath

The course's stated centre of gravity: patterns as first-class, backtracking values. Concatenation, alternation, ARB, ARBNO, BAL, SPAN and BREAK, and the conditional-assignment operator that captures what a match actually consumed.

Checkpoint 3 — due 23 April 2027 (30%)

Movement IV · weeks 10–12

What Kind of Thing Is a Value

Dynamic typing made explicit — DATATYPE, CONVERT, ARRAY, TABLE, and DATA — followed by the diagnostics a correct interpreter still owes a confused user, and a self-chosen extension to Checkpoint 3's engine as the final project.

Final project — due 21 May 2027 (30%)

Full schedule

Every lecture, studio, and assessment due date, read directly from the course's own content — this table cannot drift out of sync with the pages it links to.

WeekLectureStudioDue
1Why SNOBOLGetting started—
2Blanks that mean somethingArithmetic expressions—
3Everything is globalAssignment and a symbol table—
4Strings without a plus signStrings, concatenation, and a working evaluatorCheckpoint 1 (20%)
5Failure is a value, not an exceptionThe goto field—
6DEFINE and the shape of a callDEFINE, call frames, and RETURN/FRETURN/NRETURNCheckpoint 2 (20%)
7The cursor, made visibleBuilding the backtracking search—
8What a pattern is made ofThe primitives, not the search—
9What backtracking leaves behindGetting something back from a matchCheckpoint 3 (30%)
10Eleven kinds of thingThe exhaustiveness checker earns its keep—
11The error message you'd wantMaking CSNOBOL4 disagree with you—
12Where your interpreter's time actually goesFinishing, not addingFinal project (30%)

Where to go next

Studios

The weekly schedule and what happens in each teaching session.

Assessment

What is marked, what it is worth, and when it is due.

People

Who teaches the course and how to reach them.

Setup

The OCaml toolchain every week's starter and solution builds with.