LFortran is a modern open-source (BSD licensed) interactive Fortran compiler built on top of LLVM. It can execute user’s code interactively to allow exploratory work (much like Python, MATLAB or Julia) as well as compile to binaries with the goal to run user’s code on modern architectures such as multi-core CPUs and GPUs.
LFortran is in development (pre-alpha stage), see below for the current status and a roadmap.
Advantages of Fortran
Simple, standard, fast
Fortran is fast
Fortran is built from the ground up to translate mathematics into simple, readable, and fast code.
Basic mathematics in the core language
Rich array operations, complex numbers, exponentiation, special functions, …
Simple but powerful
More restricting (and higher level) than languages like C or C++, so that the resulting code is easier to maintain and write and easier for the compilers to optimize. There is one canonical way to do things.
LFortran allows to use Fortran interactively just like Python, Julia or MATLAB. It works in a Jupyter notebook.
Fortran is an established language, building on 62 years of expertise. Widely used for High Performance Computing (HPC).
Fortran has many excellent open source compilers: GFortran and Flang for production; new compilers in development such as F18 and LFortran.
LFortran is in development, there are features that work today, and there are features that are being implemented.
Interactive, Jupyter support
LFortran can be used as a Jupyter kernel, allowing Python/Julia-style rapid prototyping and an exploratory workflow (see the static or interactive example notebook). It can also be used from the command-line with an interactive prompt (REPL).
Clean, modular design, usable as a library
LFortran is structured around two independent modules, AST and ASR, both of which are standalone (completely independent of the rest of LFortran) and users are encouraged to use them independently for other applications and build tools on top. See the Design and Developer Tutorial documents for more details.
Initial interoperation with GFortran
LFortran has a prototype parser for GFortran module files and generation of a Fortran wrapper that allows using the module with any Fortran compiler. This feature is still under development.
It can create executables just like other Fortran compilers.
Runs on Linux, Mac and Windows
All three platforms are regularly tested by our CI.
These features are under development, there is a link to the corresponding issue so that you can track the progress by following it.
Native interoperation with other languages (and other Fortran compilers)
Import libraries written in other languages (such as C or Python) with the
usestatement, see #44. Add support for module files generated with other Fortran compilers, see #56. This will allow LFortran to run a large array of production codes.
Support for diverse hardware
LLVM makes it possible to run LFortran on diverse hardware and take advantage of native Fortran language constructs (such as
do concurrent) on multi-core CPUs and GPUs, see #57.
Full Fortran 2018 support
Currently only a subset of Fortran is implemented (we plan to document exactly what is supported #92, in the meantime it is just a bit more than what is presented in the notebook), but the goal is to have a full implementation of the latest Fortran 2018 standard, see #58.
Please vote on issues in our issue tracker that you want us to prioritize (feel free to create new ones if we are missing anything).
The tasks listed here provide early users with the opportunity to contribute bug reports, feature requests and code. This way LFortran will gradually become useful to more people and the community will grow.
Get GFortran module files working with
usemodule, both assumed-size and assumed-shape arrays (#52). This will make LFortran usable for early users. We expect to finish this task by the end of summer 2019.
Finish the implementation of the Fortran language, including the 2018 standard (#58).
Gradually rewrite the compiler in C++ for robustness and speed (#70). The Python API will not change (or only minimally).
Implement all the other cool features: