FLPR: The Fortran Language Program Remodeling library
FLPR is a general source-to-source translation framework for developing application-specific Fortran source transformation tools. This package contains:
- A "best effort" Fortran 2018 input parser for fixed and free formats.
- Data structures for manipulating source code at the program unit, statement, and physical line levels.
- Sample applications (in the
apps/directory) that illustrate usage and provide some ideas as to how you could use the library.
- This implementation is based on the 28-DEC-2017 Draft N2146 of the ISO/IEC JTC1/SC22/WG5 Fortran Language Standard, available from the Fortran Working Group.
- The FLPR parser is sensitive to whitespace in the input text in both free and fixed formats. If you have very traditional F77 fixed format code that you wish to apply a FLPR application on, you will need to preprocess it into this form with another tool. The appropriate formatting rules are given in Section 188.8.131.52 of the Standard.
FLPR is built and tested with CMake. In general, you can create
a build directory, move into it, and run
cmake $FLPR_ROOT, where
$FLPR_ROOT is the path to a FLPR checkout.
If you want to specify a particular compiler, you can prefix the cmake command with one of these lines:
CC=clang CXX=clang++ CC=gcc CXX=g++ CC=icc CXX=icpc
Note that FLPR requires C++17 library support: GCC 8+ is probably a good place to start.
There are several types of cmake builds supported:
Release. These build configurations change the compiler flags being
used. Development work should always be done in
Debug mode (the
default), while published releases should be done with
Specify a build type using one of these defines after the cmake command:
If you want to specify the install prefix, do
Note that the install target is only available for the
There are some things that can be activated that only help code developers (Doxygen documentation and etags support).
The generator-agnostic way to build the code from the configured build directory is to use:
cmake --build . # "make all"
Some other variants that are useful are:
cmake --build . --target clean # "make clean" cmake --build . --clean-first # "make clean all"
Of course, you can also run the build system directly (e.g.
ninja, etc.). See CMake documentation on the '-G' option for more
There are a limited number of unit tests available in a CTest framework. You can build and execute the tests using the command:
cmake --build . --target check
Output from failed tests can be found in Testing/Temporary/LastTest.log
Release builds, you can install the binaries with:
cmake --build . --target install