A SNOBOL4-inspired language implementation written in PL/SW, targeting the COR24 24-bit emulator first, with a later retargeting path to a 24-bit S/370-ish operating system.
SNOBOL4 is a string-oriented language from the 1960s famous for its pattern matching, dynamic typing, and unusual statement-level control flow (success / failure gotos). This project reimagines a practical subset of SNOBOL4 as a bytecode interpreter implemented entirely in PL/SW — a small systems language that compiles for the COR24 architecture.
The goal is twofold:
- Exercise PL/SW as a serious implementation language by building a non-trivial dynamic-language runtime on top of it.
- Bring a usable SNOBOL4 to the COR24 emulator (and eventually a 24-bit S/370-ish host), including strings, patterns, variables, control flow, user-defined functions, and a growing set of builtins.
The implementation is structured as a classic layered interpreter:
- Lexer / parser — reads SNOBOL4 source, including
*comments and continuation lines, producing an internal representation. - Compiler — lowers statements to a compact bytecode with opcodes for
arithmetic, string ops, assignment, branching, pattern matching, and
builtin dispatch (e.g.
OP_MODforREMDR). - VM — a stack/register-style interpreter that executes the bytecode,
manages the value heap, and handles SNOBOL4's success/failure control
flow (
:(label),:S(label),:F(label)). - Runtime / builtins — string, numeric, and I/O primitives
(
SIZE,REMDR,DUPL, pattern constructors, etc.). - Host layer — COR24 I/O, memory, and program loading via PL/SW.
See examples/ for runnable SNOBOL4 programs, including
fizzbuzz.sno, factorial.sno, pattern.sno, and dating.sno.
Detailed design and process docs live under docs/:
- PRD — product requirements and scope
- Architecture — layered architecture overview
- Design — concrete design decisions
- Plan — implementation milestones
- Process — development process
- Tools — toolchain notes
- Running the PL/SW compiler
- MMIO — memory-mapped I/O on COR24
- Storage runtime — region-stack design over PL/SW
?GETMAIN/?FREEMAIN - Storage use audit — what's actually in the current 128 KB of statics
- AI agent instructions
- Research notes
The project uses just as its task runner.
See justfile for available recipes, and
docs/running-plsw-compiler.md for details
on invoking the PL/SW compiler and running programs on the COR24 emulator.
The build relies on the shared COR24 toolchain installed on $PATH for
every d* user — no sibling clones, no $HOME/... paths:
| Binary | Use |
|---|---|
pl-sw |
PL/SW compiler (cor24-emu --lgo plsw.lgo) |
cor24-asm |
Assembler: .s → .lgo / .bin / .lst |
cor24-emu |
Runtime emulator |
link24 |
Module linker (combines per-module .bins) |
meta-gen |
EXPORT/FIXUP metadata generator for link24 |
The PL/SW compiler image is shipped at
/disk1/github/softwarewrighter/devgroup/work/lib/cor24/plsw.lgo; you do
not need to rebuild it.
just build— modular build →build/snobol4.bin(loadable viacor24-emu --load-binary build/snobol4.bin@0 --entry 0).just rebuild— same, ignoring the dep manifest.just build-lgo— produces the canonical shippablebuild/snobol4.lgoby wrapping the linked.binasL-record text. Mike installs this towork/lib/cor24/snobol4.lgofor downstream consumers (e.g. dcftn's Fortran compiler).just hello,just count,just span, etc. — run individual demos.just demos— run the full demo suite.
cor24-emu --lgo <file> currently ignores any --load-binary arguments
on the same command line (the lgo dispatch arm doesn't call
load_binaries_and_patches). Because the SNOBOL4 interpreter expects its
program source loaded at memory 0x080000, the snobol4.lgo artifact
cannot yet be invoked via the planned exec cor24-emu --lgo snobol4.lgo "$@" wrapper. Until cor24-emu is fixed (see brief
tools/briefs/dcemu-lgo-load-binary-merge.md), the working invocation
is:
cor24-emu --load-binary build/snobol4.bin@0 \
--load-binary <prog>.sno@0x080000 \
--entry 0
(This is what scripts/run-snobol4.sh already does.)
Copyright (c) 2026 Michael A Wright
(See COPYRIGHT.)
Released under the MIT License. See LICENSE for the full
text.