New Release of Forgex - Fortran Regular Expression

Hi, all.

I’ve been working on regular expressions in Fortran over the last few days.

As a result, I’ve released version 2.0 of Forgex, and it is now available on GitHub.

This release includes faster matching using lazy evaluation and several fixes.

In previous versions, a deterministic finite automaton (DFA), equivalent to a non-deterministic finite automaton (NFA), was constructed in its entirety by the power set construction method before matching with a string.

Starting with this version, a dynamic lazy evaluation approach is adopted, in which the DFA is constructed simultaneously with matching, enabling a significant reduction in the time and space required for calculations.

I’m thinking about what to do next with this project, so if you have any suggestions feel free to share them!

For example:

  • thread parallelization of matching,
  • optimization by literal searching.
13 Likes

@amasaki203 , mega kudos on super effort, your code is outstanding at first glance, great service.

Re: “… what to do next with this project, so if you have any suggestions feel free to share them!,” how about making this part of Fortran stdlib?

A possible vision for Fortran stdlib can be to have processors deploy the stdlib with their compiler installation packages, say LFortran, GCC/gfortran, Intel oneAPI toolkit, etc. to all include the standard library optimized to their compiler implementations. And having support for regex in a “standard” library for Fortran will be highly valuable for many Fortran practitioners.

4 Likes

Thank you for your very attractive proposal. I think it would be very useful to have a regular expression processor in stdlib.

However, I feel that there are many hurdles that this project, as well as I myself, should overcome (primarily whether my implementation fits into the workflow of the stdlib).

I cannot make a decision on this idea by myself, so I would like to take more time and also seek advice from all others.

Great job! In my opinion, the next most important feature is having a good documentation. For my codes I try to reach a 1:1 ratio between comments and lines of code, which really helps future me to understand the code after some time. You can read some instructions on how to use FORD in this post. Afterwards you could focus on implementing the CI. I know that these aren’t the most fun activities, but having a well documented code helps to attract contributors, and a good CI prevents countless bugs from happening.

2 Likes

This is an important point for me. I had forgotten to improve the documentation for developers, so thank you for reminding me. I agree that this topic is essential, so I will make it a high priority.

On the other hand, I have little experience with CI, so I will read the post you shared and learn more from it and others.

1 Like