OFC - Open Fortran Compiler
Currently OFC is a FORTRAN front-end capable of parsing and performing semantic analysis on Fortran. We're targeting legacy FORTRAN first, and can currently parse and semantically analyse most F77 and earlier, providing syntax and semantic warnings and errors.
- Produce a FORTRAN static code analysis tool.
- Produce a FORTRAN modernizer which can reprint legacy FORTRAN as F90 where possible.
- Produce an alternative FORTRAN front-end for open-source compilers.
- Parse, semantically analyse and re-print ALL NIST F77 tests.
- Safe translation from F77 to F90 syntax where possible.
It's recommended that you clone ofc recursively, as it has a submodule:
git clone https://github.com/CodethinkLabs/ofc.git --recurse-submodules
For git 2.12 or earlier use
To install ofc, do:
Note that the ofc binary can be invoked locally without an install, and the tests will run using the locally built binary.
To invoke ofc currently, simply run it over a fortran file:
The compiler options will be automatically detected from the file name, but this can be overridden using commandline flags which are printed by invoking ofc with no source file.
To print the parse and semantic trees, use the --parse-tree and --sema-tree flags.
Test Suite: gfortran valgrind
Static Code Analysis: cppcheck clang, scanbuild
We run a test suite including the NIST F77 tests using:
To make a html report (tests/out/report.html) use:
The full report takes a long time to build as it runs valgrind over both the debug and optimized binaries. To make a quick report which does every step except valgrind, use:
Note: Tests run from the build directory will use the built ofc rather than the installed one.
We run cppcheck over the tree using:
We run scanbuild over the tree using:
We also have a rule to compile all files at once to produce more warnings using:
You can contact us at #open-fortran-compiler on irc.freenode.net or via the e-mails used in our git commits.