Documentation

About pymdl

What pymdl is, how to run it, what is where in the repository, and how it is checked.

An implementation of MDL (Muddle), MIT's Lisp-family language, in Python. pymdl includes the language interpreter, debugging tools, and library system. It runs MIT's compiler and assembler as MDL programs, provides a native compiler that produces Python code, and includes a PDP-10 emulator for compatible machine-code programs. Python peers implement selected routines without the emulator.

The book is docs/pymdl/. Start with What pymdl is, then Running pymdl and Setting up. The two era manuals it is built from are vendored beside it, docs/mdl/ and docs/mdl-environment/. The pymdl book is intended to be complete on its own; these originals preserve its historical sources.

Running

Python 3 standard library only (3.13 or later recommended); greenlet is optional and enables the coroutine SUBRs.

PYTHONPATH=src python tools/build_mdllib.py   # once: build the system library (~40 s)
PYTHONPATH=src python -m pymdl.repl           # the listener; ESC evaluates
echo '<+ 1 2>' | PYTHONPATH=src python -m pymdl.repl
PYTHONPATH=src python -m pytest -q            # the test suite

demo/ holds four era programs that load, compile and run -- DOCTOR, the MDL ELIZA, among them; its README says how.

What is where

src/pymdl/ the interpreter: reader, types, evaluator, the built-ins, the package system, the emulator
src/pymdl/mdl/ the era's MDL, byte for byte with provenance in MANIFEST.tsv: the MUDBUG tools, the library system, MIT's compiler (compil/, departures in its CHANGES.md), the library packages
src/pymdl/pymac/ this machine's code for the era's compiled code
docs/pymdl/ the book; docs/mdl/, docs/mdl-environment/ the manuals it reproduces
tests/ the suite, including the manuals' worked examples, the era batteries measured on MDL 55, the compiler gate
tools/ the build steps and the measuring instruments (tools/README.md)
demo/ the demos

Outside the repository: the MIT tape archive the tools measure against (PYMDL_ERA_CORPUS, default ~/mdl-1971-1987), the apsim simulator that runs the real MDL 55 for the questions the manuals do not answer, and Zork, which is a program pymdl runs and lives in its own repository.

How it is checked

The manuals' worked examples and this book's examples run in the test suite. Where the text is silent, MDL 55 itself is asked, under apsim, and the answer becomes a test. MIT's compiler, running interpreted here, matches MDL 55's output on 635 of 640 compiler test shapes. Chapter 34 describes the exceptions and the separate self-compilation, library, and debugging-tool measurements.