# FORTRAN 704 Run early FORTRAN programs on a modern POSIX machine. This C implementation parses fixed-form cards, checks the selected dialect and executes an internal program representation with IBM 704 word arithmetic. | Mode | Language | | --- | --- | | `--std=2` (default) | FORTRAN II, 1958 subset with subprograms | | `--std=1` | FORTRAN I subset, with its dialect restrictions | | `--std=0` | Subset of the 10 November 1954 preliminary report | The project includes formatted card and printer I/O, tape and drum storage, scripted debugging, a bounded SAP/BSS object-subprogram runner, a Jupyter kernel and a VS Code extension. The 1954 mode implements a proposal that never shipped as a compiler. [Documentation](https://evvaletov.github.io/fortran-704/) · [GitHub](https://github.com/evvaletov/fortran-704) · [SDF mirror](https://git.sdf.org/evv/fortran-704) ## Build and run Use GCC or Clang with C11 and `__int128` support, Make and a POSIX host. Python 3.12+ runs the full test and oracle tooling; the executable itself has no Python dependency. ```sh git clone https://github.com/evvaletov/fortran-704.git cd fortran-704 make ./fortran704 tests/hello.f make test make test-oracle-strict ``` The default compiler is GCC. To use Clang, add `CC=clang` to each Make command, including `make CC=clang test` and `make CC=clang test-oracle-strict`. Run `make clean` before changing compilers in an existing checkout. The sample prints `HELLO, WORLD`. Source statements begin in column 7; columns 1-5 hold labels and column 6 marks a continuation. See the [getting started guide](docs/getting-started.md) for a complete card deck, input, dialect selection, notebooks and editor setup. ## Inspect a run ```sh ./fortran704 --debug-script examples/debug-media/commands.txt --debug-output trace.txt --save-media state.f704m --export-text 1 exchange.txt examples/debug-media/write.f ./fortran704 --load-media state.f704m examples/debug-media/read.f ``` Use a fresh `trace.txt` path. The monitor supports statement stepping, breakpoints, variable watches and named inspection checkpoints. It can display source cards, physical word addresses, arithmetic flags, tape records and drum words. Saved media survives a new process; inspection checkpoints do not restore execution. The [debug and media guide](docs/debug-media.md) documents the commands and file format. ASCII record exchange is tested when the companion [GW-BASIC implementation](https://github.com/evvaletov/gw-basic-2026) is present; standalone checkouts skip that integration test. ## Compatibility and evidence This implementation runs the documented language subset. Its execution order can differ from the original compiler's instruction stream. The [dialect notes](dialect/fortran2.md) state the supported behaviour and gaps. The [comparison corpus](tests/oracle/README.md) contains 14 independently authored decks and 26 exact dialect comparisons against captured results from the preserved FORTRAN II compiler running under Sim704. Original sources, manuals and system tapes are fetched separately and are not distributed here. The measured library grid covers 25 inputs for each of six routines. It sets the incoming MQ register to a known state; arbitrary register context and compiler instruction ordering remain compatibility limits. Five corpus cases differ between Sim704 and native i704, and those differing results are retained. The [validation record](docs/word-machine-validation.md) explains the evidence. The SAP runner supports computational subprograms, with an explicit instruction subset in the [SAP/BSS guide](docs/sap-bss.md). ## Development ```sh make test make test-oracle python3 -m pip install -e . python3 -m fortran704kernel.test_kernel node --test editors/vscode/tests/*.test.js python3 -m pip install -r publication/requirements.txt make docs ``` [Contributing](CONTRIBUTING.md) describes checks and reference provenance. [The roadmap](docs/roadmap.md) lists the next work. Source and newly authored examples are available under the [MIT licence](LICENSE); external historical material retains its own provenance.