Eremey Valetov eadb6ba14f
Verify and publish documentation / test (macos-latest) (push) Canceled after 0s
Verify and publish documentation / test (ubuntu-latest) (push) Canceled after 0s
Verify and publish documentation / docs (push) Canceled after 0s
Verify and publish documentation / deploy (push) Canceled after 0s
Keep local agent instructions out of version control
2026-11-21 17:46:34 -05:00

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 · GitHub · SDF mirror

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.

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 for a complete card deck, input, dialect selection, notebooks and editor setup.

Inspect a run

./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 documents the commands and file format. ASCII record exchange is tested when the companion GW-BASIC implementation 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 state the supported behaviour and gaps. The comparison corpus 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 explains the evidence. The SAP runner supports computational subprograms, with an explicit instruction subset in the SAP/BSS guide.

Development

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 describes checks and reference provenance. The roadmap lists the next work. Source and newly authored examples are available under the MIT licence; external historical material retains its own provenance.

S
Description
No description provided
Readme MIT
544 KiB
0 Stars 1 Watchers 0 Forks
Languages
C 51.7%
Python 27.5%
Fortran 12.8%
Shell 4.8%
JavaScript 2.1%
Other 1.1%