Skip to main content

Week 4 Studio: Strings, concatenation, and a working evaluator

String literals and concatenation by juxtaposition, wiring weeks 1–4 into one evaluator that runs real toy SNOBOL-subset programs

15 March 2027

Before the session

Bring your week 3 evaluator: lexer, parser, symbol table, and a tree-walking evaluator for arithmetic and variables. This session adds the last piece Movement I needs.

In the session

Sample transcript

Genuine captured output from this course’s own checkpoint-1 reference solution, run against three example programs — not a mockup:

$ dune exec bin/main.exe -- examples/hello.sno
HELLO, SNOBOL4!

$ dune exec bin/main.exe -- examples/arith.sno
14
20
3

$ dune exec bin/main.exe -- examples/blanks.sno
2
5-3

blanks.sno is the one worth tracing by hand before the session: it is built specifically to show that a blank can mean concatenation in one position and nothing at all in another, depending on what’s adjacent to it — the same blank-sensitivity week 2’s lecture introduced.

Afterwards

Checkpoint 1 is due at the end of this week and asks you to complete a partially-implemented starter covering exactly this material. Keep your working evaluator from this session — it’s the reference you’ll check the checkpoint starter’s expected behaviour against, not a separate piece of work.

The spec

What you bring to the session. Written so a reader can tell whether it has been met without asking you.

Teaching team