Implementation Notes

February 23, 2026 ยท View on GitHub

Status and known limitations for the Fortran grammar collection. This is the canonical status reference for parser/grammar coverage in this repository.

Grammar Status

All grammars are complete and tested. Each implements the full syntax of its standard.

StandardStatusTestsNotes
FORTRAN 1957CompleteYesStrict fixed-form validator in tools/strict_fixed_form.py
FORTRAN IICompleteYesSUBROUTINE, FUNCTION, COMMON, Hollerith
FORTRAN 66CompleteYesFirst ANSI standard
FORTRAN 77CompleteYesCHARACTER, IF-THEN-ELSE, last fixed-form-only
Fortran 90CompleteExtensiveFree-form, modules, derived types, arrays
Fortran 95CompleteYesFORALL, PURE/ELEMENTAL
Fortran 2003CompleteExtensiveOOP, C interop, PDTs, IEEE
Fortran 2008CompleteYesCoarrays, submodules, DO CONCURRENT
Fortran 2018CompleteYesTeams, events, atomics
Fortran 2023CompleteYesConditional expressions, TYPEOF/CLASSOF
Fortran 2028 (WD)CompleteYesTEMPLATE/REQUIREMENT/REQUIRE(S)/INSTANTIATE facility
LFortranCompleteYesF2028 base + inline instantiation ({} and ^()); traits syntax (implements, sealed, initial)
LFortran InferCompleteYesType inference, global scope, auto realloc

Status boundaries:

  • "Complete" means grammar-level parsing support in this repository.
  • Semantic checks (trait conformance, inheritance restrictions, signature matching) are intentionally deferred to semantic analysis.
  • See LFortran Design: Deferred Trait Items (Semantic Phase) for the deferred trait list.

Fortran 2028 Delta Audit (J3/26-007)

In-scope syntax delta implemented on top of Fortran 2023:

  • Tokens: TEMPLATE, REQUIREMENT, REQUIRE, REQUIRES, INSTANTIATE, DEFERRED, CONSTANT, {, }
  • Constructs:
    • template / end template
    • requirement / end requirement
    • require and requires statements
    • instantiate statements (including ONLY rename and procedure alias form)
    • templated function and templated subroutine program units
    • deferred type/constant/procedure declarations

Missing productions/tokens in this in-scope F2028 template family: none.

Semantic Validation

Grammar-level parsing is complete. Semantic validators exist in tools/ for:

  • Fixed-form column layout (strict_fixed_form.py) - FORTRAN 1957/II/90
  • Hollerith length validation - 1957/II
  • Numeric constant ranges - 1957
  • FORMAT descriptor validation - 1957
  • Statement ordering - FORTRAN 66/77, Fortran 90
  • Expression precedence - Fortran 90+
  • CYCLE/EXIT context - Fortran 90+
  • ALLOCATE constraints - Fortran 2003/2008
  • BLOCK construct semantics - Fortran 2008

Design Decisions

Fixed-Form Model

Grammars use layout-lenient parsing:

  • Tokens parsed by order, not column position
  • Strict validation available via tools/strict_fixed_form.py
  • Supports both legacy .f and modern .f90 layouts

Expression Grammar

Operator precedence fully encoded for Fortran 90+ (issue #678 resolved).

Scope Boundary

Grammars are syntactic. Type checking and interface matching are out of scope.

References

StandardDocument
FORTRAN 1957IBM C28-6003
FORTRAN IIIBM C28-6000-2
FORTRAN 66ANSI X3.9-1966
FORTRAN 77ANSI X3.9-1978
Fortran 90ISO/IEC 1539:1991
Fortran 95ISO/IEC 1539-1:1997
Fortran 2003ISO/IEC 1539-1:2004
Fortran 2008ISO/IEC 1539-1:2010
Fortran 2018ISO/IEC 1539-1:2018
Fortran 2023ISO/IEC 1539-1:2023
Fortran 2028 (WD)J3/26-007
LFortranJ3/24-107r1 + traits proposal

PDFs in validation/pdfs/.