The Maturity of the Fortran Open-Source Ecosystem

I finally had the experience I was dreaming of when I started working on fpm 4 years ago, and wanted to share.

Yesterday I finally encountered a situation that really called for regular expression support in test selection in veggies/garden (my unit testing framework). I’ve had a minimal version of the feature available for quite a while now, but it was super basic. Just “does this exact string appear in the description of this test”, but the situation arose where I really needed “and and or” type logic in the selection.

I knew regular expressions was going to be part of the solution, and I’d had it in mind for a while now. I went and found @Beliavsky’s project listing, and to my surprise there were several options for regular expression libraries. My requirements were

  1. no external dependencies (i.e. things that must be preinstalled on a system)
  2. has support for regular expression groups and or operator (|)
  3. has a procedure to simply inquire if a string contains a match to the regular expression
  4. a permissive license
  5. pure Fortran a bonus

10-15 minutes of looking at the descriptions and docs and I picked forgex to try first. It was dead simple drop in and Just Worked™, only requiring me to change in a few places the expression self%description.includes.filter_string to filter_string.in.self%description. I had what could easily have been a major project done in a matter of 30-45 minutes!

I want to say a major thank you to everybody that’s been helping with developing the tooling, logistics, coordination and collaboration. I see no reason this experience won’t become more commonplace. If that’s true, I feel like maybe we’ve succeeded in saving Fortran.

For those interested in the details, the changes were literally as simple as this little PR, and now I’ve got new releases of garden and veggies with greatly improved support for selecting subsets of a test suite to execute.

27 Likes

I use my list to find codes for an algorithm by saving the README.md to my PC and grepping it (I use findstr on Windows). For example

grep -i "regular expression" "c:\some_dir\README.md"

gives

forgex: regular expression engine using a deterministic finite automaton (DFA) approach, by Shinobu Amasaki. It provides .in. and .match. operators to detect if a pattern is contained in or exactly matches a string.
fortran_pcre: Fortran wrapper around the C PCRE regular expression library
fortran-pcre2: Fortran 2018 ISO_C_BINDING interfaces to Perl-compatible Regular Expressions 2 (PCRE2), by interkosmos
fortran-regex: port by Federico Perini of the tiny-regex-c library for regular expressions. It is based on the original C implementation, but the API is modelled in Fortran style, which is similar to the intrinsic index function.
Fregex: Perl Compatible Regular Expressions (PCRE) wrapper for Fortran by Ian Giestas Pauli
M_match: basic implementation in Fortran of a subset of regular expressions as described in “Software Tools” by Kernighan and Plauger, 1976.
M_regex: Fortran interface by urbanjost to the POSIX 1003.2 regular expression library using ISO_C_BINDING
mod_pcreposix: module for working (in Unix) with the Perl compatible regular expressions, by tranqv

8 Likes

Thanks @Beliavsky for maintaining your Fortran code list! It is ever growing and more valuable.

I was thinking:

Note also that @Beliavsky 's lists tend toward exhaustiveness while the Fortran-lang database is a selection of mature software (as explained in the submission page). They are therefore complementary.

1 Like

Is fpm funded by NSF? I see no reason it should not.

It is not. If anyone would be interested in applying for funding from them I think it would be worth a shot :wink:

NSF POSE is the relevant call:

This year is due Sep 5. I’d be interested in participating in the proposal.

I’m not clear if general-purpose tools would be applicable here as POSE focuses on open source software for research. But perhaps the numerical+scientific subset of Fortran ecosystem could be of interest to NSF. I think it should, and it’s easy to demonstrate how essential for science it is.

2 Likes

The Fortran ecosystem includes tools that may be written in other languages, which are collected in another list of mine. Besides browsing it, one can save the README.md of the project and create a script using grep such that ftools namelist for example gives

M_CLI: cracks the command line when given a NAMELIST and a prototype string that looks very much like an invocation of the program, by urbanjost and Laurence Kedward. Using the NAMELIST group has the benefit that there is no requirement to convert the strings to their required types or to duplicate the type declarations.
f90-namelist-mode: extension to Emacs f90-mode to handle Fortran namelists, by ZedThree
f90nml: Python module and command line tool, by Marshall Ward et al., that provides a simple interface for the reading, writing, and modifying Fortran namelist files. A namelist file is parsed and converted into an Namelist object, which behaves like a standard Python dict
Fortran90Namelists.jl: Julia implementation of Python f90nml for working with Fortran namelists
FortranNamelist: Java reading class for Fortran namelists, by Jonathan Schilling
Fortran Namelist Reader: Python and Matlab readers for Fortran namelist => dict / struct, from scivision
fortran-namelist: Ruby library to manipulate Fortran namelists, by Saji Hameed
namelist_python: Fortran namelist parser in Python, by Leif Denby et al.
nml: R package for parsing Fortran namelist files, by Jem Stachelek et al.
nml: query/modify utility in Clojure for Fortran namelists, by Paul Madden and Jemma Stachelek
thenamelisttool: provide command line tools useful to work with namelists or pack of namelists (update them, compare them, …), by Louis-François Meunier and Alexandre Mary
CompareFortranNamelists: Python class to compare Fortran namelists, by Kai Keller
nmltab: Python 3 module and command-line tool to tabulate, semantically diff, superset and consistently format Fortran namelist files, with output to text, markdown, csv, latex and namelists, by Andrew Kiss and Aidan Heerdegen. Requires Python 3.4 or later, and f90nml (amongst other packages).
nml-to-f90: generates Fortran source code for handling parameter I/O from a namelist, by perrette

2 Likes