As a PhD student who heavily relies on highly optimized Fortran code and who has spent time translating small Fortran projects to Python+NumPy, I don’t understand why anyone would start a new project in Fortran. The only people I know who write Fortran do it because of legacy code or because that’s the only language they know.
Since calling Fortran is fairly well supported for languages used in/designed for science (Python, MATLAB, Julia), I don’t see legacy code being as big a driver.
> Automatic transformation of code to older Fortran standard that other Fortran compilers can compile — allowing developers to use the latest standard, and still be able to use current Fortran compilers
Sometimes I have to make programs that run in machines nobody is sure about the configuration details.
Does it support "intersection format"? http://fortranwiki.org/fortran/show/Continuation+lines
Does it have a linter that can remove linenumbers in the easy cases?
It doesn't yet. Are you interested in this for parsing or for code generation?
If for code generation (i.e., LFortran parses your Fortran code, and then generates a Fortran code back in this format), then I think that will not be that difficult to implement, I think this would be useful.
Regarding parsing, for now my parser is for free form. But I think it would be useful to also have a fixed form parser --- it might need to be a separate parser, but the rest of LFortran can be reused.
> Does it have a linter that can remove linenumbers in the easy cases?
Can you give an example of what you mean?
One issue with linting is that currently the parser is not round-trippable (https://gitlab.com/lfortran/lfortran/issues/42). That means that it can generate the original code back, but it will be formatted differently (mostly white space). Most compilers are not round-trippable. The only compiler that I know about that is round-trippable is C#. Essentially one has to keep track of white space and other formatting, and I didn't want this to complicate the internal representation. I wanted to design the internal representation that is as simple as possible. And then see if one can add optional nodes for white space, similarly how C# does it. If it's possible, then I'll do it.
However, even if it is not round-trippable, the linter can simply generate a nice Fortran code back, and if people use the linter like `clang-format`, enforced by the CI, then it might not be a problem.
Here is the current implementation of ASR (Abstract Semantic Representation) to AST (Abstract Semantic Tree):
And AST to source code:
We will be extending it this summer to support more Fortran features.
It's mostly about priority at this point --- I want all of the above to be implemented, it's just about what I do first and what second. Feel free to vote or open new issues here:
See also my current roadmap/priorities at the bottom of:
Also, there is a huge amount of legacy code flying around. Write the fixed form parser as soon as you can.
An example of legacy code with linenumbers is: (Extracted from real code, I only changed the variable names.)
do 1 i = 1 , n
do 1 j = 1 , n
I see what you mean --- that's just a for loop. I created an issue for it: https://gitlab.com/lfortran/lfortran/issues/83.
Thanks for the feedback!