Documentation

Documentation

Index of the forterp documentation and the authoritative standards it targets.

Runnable material lives outside docs/:

  • examples/ — short Python scripts showing how to drive forterp as a library (run source, capture output, pick a dialect/target, read results from COMMON).
  • demos/ — genuine 1970s FORTRAN to run through the interpreter: verbatim netlib libraries with drivers, DECsystem-10 tape sources, and a 1971 Game of Life.

These docs are also published as a site via GitHub Pages — the build machinery lives in gh-pages/ (a small markdown-it-py static-site generator); the built site is committed under gh-pages/public/ (kept in sync by the .githooks pre-commit hook) and deployed by .github/workflows/pages.yml.

Authoritative standards

forterp targets three specifications. The references above summarize them as implemented; the primary sources are:

  • ANSI X3.9-1966, "FORTRAN" — the FORTRAN 66 standard (the first standardized FORTRAN). This is the base language. The standard is archived by the ISO/IEC JTC1/SC22/WG5 Fortran committee (https://wg5-fortran.org/ARCHIVE/Fortran66.pdf).
  • ANSI X3.9-1978, "FORTRAN" — the FORTRAN 77 standard, layered on the F66 base by the F77 dialect (the CHARACTER type, the block IF, list-directed I/O, INQUIRE).
  • DECsystem-10 FORTRAN-10 Language Manual (V5) — the DEC dialect forterp actually reproduces (the 36-bit word model, SIXBIT/A5 packing, octal/Hollerith literals, IAND/IOR/shift intrinsics, FOROTS binary I/O, tab-format source). This is the document the interpreter was validated against.

Conformance

The interpreter is exercised against the FCVS (FORTRAN Compiler Validation System) audit corpus — one set of 192 routines in tests/fcvs/, pristine from the public-domain NIST suite, with their canonical .DAT input decks. FORTRAN-66 is checked against the F66-valid subset, and FORTRAN-77 against the whole corpus. All 192 parse, run every declared sub-test, and self-check with zero failures. gfortran golden outputs under tests/fcvs_golden/ independently validate the print-only routines (no gfortran needed at test time): with the canonical decks gfortran runs the whole corpus and forterp byte-matches 191 of 192 — the lone exception (FM111) is a documented gfortran outlier where forterp matches the routine's own CORRECT line. Run pytest to execute them; see the forterp manual §13 (Testing) for the full breakdown.

Security & trust model

forterp is an interpreter, not a sandbox: a program runs with the invoking process's privileges and its OPEN/READ/WRITE reach the real filesystem (absolute or .. paths escape save_root). There is no network, eval, or subprocess reachable from FORTRAN, and execution and allocation are bounded (eng.max_steps, eng.max_array_words) — but do not run untrusted source expecting containment; confine it at the OS level instead. See the Security & trust model section of the top-level README.