COMING SOON
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.
Implementation Notes
- 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 6.3.2.2 of the Standard.
Installation
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.
Configuration
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: Debug
or
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 Release
.
Specify a build type using one of these defines after the cmake command:
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_BUILD_TYPE=Release
If you want to specify the install prefix, do
-DCMAKE_INSTALL_PREFIX:PATH=/usr/some/path
Note that the install target is only available for the Release
build.
There are some things that can be activated that only help code developers (Doxygen documentation and etags support).
-DDEVEL=ON
Building
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. make
,
ninja
, etc.). See CMake documentation on the '-G' option for more
details.
Testing
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
Installation
For Release
builds, you can install the binaries with:
cmake --build . --target install