CGO_ENABLED=0LICENSE=BSD-3-Clausego-embedded-fortran is in development. Its repository, fortran, is at v0.17.0, which runs go-notebook's fortran cells in one session (eval.Session; their variables stay in Fortran for now): a Go front end (a parser and a semantic analyser), an evaluator that runs all 14 golden programs byte-identical to gfortran 15.2.0, an I/O runtime ported from flang-rt (71 096 of 71 135 differential cases identical, the 39 others in documented classes), an oracle harness, and a measured gate whose first figures give the verdict A first. Known limits: the evaluator's scalar loops are 8x to 108x behind gfortran -O2 (#17), the gate's browser lane is not implemented (#5), and the evaluator does not run type extension, select type, pointer components, character arrays, read from a unit or complex variables yet. It is meant to back the fortran cells of go-notebook.
release fortran v0.17.0 oracle gfortran 15.2.0 parse FCVS 180/180 files eval 14/14 golden programs rt 71096/71135 I/O cases gate verdict: A first open #17 loops 8x-108x behind open #5 browser lane goal fortran cells in go-notebook
A front end, an evaluator and a runtime in pure Go, each stage checked against a reference. The plan is the roadmap's bibliography.
syntax is a lexer and recursive-descent parser (free and fixed form, include, byte offsets that resolve to file:line:col), written from the clauses of F2018 (J3/18-007r1) it cites. sema turns a parsed file into a typed tree: scopes and symbols, implicit typing, kinds, constants, expression typing, use, derived types, generic resolution, argument association and shape conformance.
eval compiles the typed tree into closures over typed slots and runs all 14 golden programs byte-identical to their goldens (stdout, stderr and exit status), which gfortran 15.2.0 produced. It refuses what it does not run with a positioned error.
rt is the formatted and list-directed input and output, ported from LLVM flang-rt (llvmorg-23.1.4, Apache-2.0 WITH LLVM-exception) and made to print what gfortran 15.2.0 prints, because that is what a notebook's print * shows. A statement on a warm unit allocates nothing.
The reference is gfortran 15.2.0, run natively. It is GPL and is only ever run as a program, never linked or ported. foracle installs it without root, and "correct" means the same exit status and the same stdout and stderr bytes.
Bib section 4.2 chooses between A, a pure-Go evaluator, and B, lowering to go-embedded-c's IR compiled to wasm32. The rule is implemented once with its thresholds (5, 2, 1.2) pinned by a test, and a checksum out of its bound is a failure, not a time.
The fortran cells of go-notebook, as go-embedded-c backs its C cells. sema.Session splits cells into a session module and a run subroutine and carries what go-notebook's graph needs, and since v0.17.0 eval.Session runs the cells one after the other: variables keep their values, modules, types and procedures persist, and an infinite loop is stopped by a step bound and the context. go-notebook v0.17.0 links it (fcells). The variables stay in Fortran, as R's do: they do not cross to the other languages yet, and the playground's core does not link the runtime yet.
BSD 3-Clause. What is only run, gfortran and the GPL test corpora, is listed in NOTICE and never linked, ported or committed; the I/O runtime keeps the notice of the flang-rt files it ports.
States are the status table of the fortran README at v0.17.0.
Done: internal/oracle, cmd/foracle, pinned gfortran 15.2.0, a golden file, a corpus runner and the reference column of the gate.
Syntax done: a lexer (free and fixed form, continuation, include) and a parser. Of the files gfortran accepts, the parser accepts 100 % of FCVS (180 files), 99.7 % of the gfortran torture suite (314 files) and 98.0 % of gfortran.dg (8 306 files). Open: the playground side of the gate.
The package sema (scopes, symbols, implicit typing, kinds, constants, expression typing, use, derived types), the cell splitter, the session module and the go-notebook-facing analysis, generic resolution, argument association, explicit-interface requirements and intent at calls, and shape conformance. eval consumes the typed tree. Remaining semantics are listed under Not yet in the README.
As the gate decides: A, a closure compiler over the typed tree, or B, lowering to go-embedded-c's IR. The status table lists it as planned; the package eval is the seed of M3-A and grows in parts (v0.11.0 to v0.16.0: kinds and control flow, procedures, modules and characters, arrays, substrings and internal files, derived types). Not yet: type extension, select type and dynamic dispatch, pointer components, character arrays, read from a unit, complex variables, optional arguments.
The package rt (formatted and list-directed input and output, units, internal files), ported from flang-rt; eval's print and write run on it. The elemental intrinsics and the rest of the runtime are open.
eval.Session runs cells one after the other (v0.17.0) and go-notebook's fcells package links it; errors are positioned. Variables do not cross to other languages yet, and the playground's core does not link it yet.
FCVS, gfortran.dg run tests, reference LAPACK built by our front end, and the performance table.
Every number below is copied from the fortran README at v0.17.0. Where the machine was too loaded to measure, no figure is published.
rt against gfortran 15.2.0, byte for byte (formats times values, including ±0, denormals, infinities, NaN, field overflow and errors with iostat). The 39 others are in documented classes: 26 are EN with many digits, 13 are input corner cases. 0 are unexplained.
eval runs all 14 golden programs of testdata/programs and each is byte-identical to its golden: stdout, stderr and exit status.
FCVS: 180 of 180 files parse. gfortran torture: 313 of 314 (99.7 %). gfortran.dg: 7 496 of 8 306 (90.2 %), where gfortran itself accepts 6 096 and many files exist to be refused.
On gfortran.dg (8 306 files), both accept 5 753 files, 291 are refused only by us (125 by the parser, 166 by the analyser) and 1 202 are accepted only by us, because they are written to be refused for reasons not checked yet.
darwin/arm64, one core, 7 interleaved rounds. Time over gfortran -O2 on the loop kernels: K1 8.33, K2 93.31, K3L 108.06 for contender A. Array kernels against direct go-ndarray: K4 0.793, K3 matmul 1.065. g(rA)/g(rB0) = 0.683. Verdict: A first, between; re-gate after go-embedded-c M3.
Parse throughput against gfortran -fsyntax-only, analysis time and I/O throughput were not measured: the machine's load was above the bound of 8, so the tools refused and no figure is published rather than a loaded one. The gate's playground home is not measured either (#5).
On the gate's scalar loops, the evaluator is 8x to 108x behind gfortran -O2 (8.33 on K1, 93.31 on K2, 108.06 on K3L), an open defect (#17). The desktop ratio is at most 2 and both array kernels are within 1.2 of direct go-ndarray, but the playground home is not measured (#5), so the rule cannot pick A outright: the verdict is "A first", and it is to be re-gated after go-embedded-c M3.
The status, the oracle and the gate →The organization holds the implementation, fortran, and its documentation and brand.
The implementation, github.com/go-embedded-fortran/fortran, latest release v0.17.0: the syntax parser, the sema analyser, the eval evaluator, the rt I/O runtime ported from flang-rt, the foracle oracle harness and the gate of bib section 4.2. Open defects: loop speed 8x to 108x behind gfortran (#17), the gate's browser lane (#5).
The documentation (Hugo + Hextra): the status, the oracle, the gate and its figures, and the limits. Source →
Logos and icons for the organization, in SVG / PNG / JPG / ICO / ICNS across colour, white and black variants. The mark is Fortran's double colon, ::.