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 alpha (it is expected to not work on third-party codes and users enthusiastically participate in bug reporting and fixing).

Main repository at GitHub: https://github.com/lfortran/lfortran Star

Try LFortran in your browser using WebAssembly: https://dev.lfortran.org/

Progress towards beta:

Progress bar

LFortran will reach beta when it can reliably compile 10 third-party production codes. Current status is 6/10:

Twitter: @lfortranorg
Any questions? Ask us on Zulip project chat or our mailing list. You can also use the Fortran Discourse forum.

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.

Established language

Fortran is an established language, building on 64 years of expertise. Widely used for High Performance Computing (HPC).

Open source

Fortran has many excellent open source compilers: GFortran for production; new compilers in development such as Flang and LFortran.

Feature Highlights

LFortran is in development, there are features that work today, and there are features that are being implemented.

Works today

  • Full Fortran 2018 parser
    LFortran can parse any Fortran 2018 syntax to AST (Abstract Syntax Tree) and format it back as Fortran source code (lfortran fmt).

  • Interactive, Jupyter support
    LFortran can be used as a Jupyter kernel, allowing Python/Julia-style rapid prototyping and an exploratory workflow (conda install jupyter lfortran). 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 (Abstract Syntax Tree) and ASR (Abstract Semantic Representation), 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.

  • Create executables
    It can create executables just like other Fortran compilers.

  • Runs on Linux, Mac, Windows and WebAssembly
    All four platforms are regularly tested by our CI.

  • Several backends The LLVM can be used to compile to binaries and for interactive usage. The C++ backend translates Fortran code to a readable C++ code. The x86 backend allows very fast compilation directly to x86 machine code. The WebAssembly backend can quickly generate WASM.

Under Development

These features are under development:

  • Full Fortran 2018 support
    The parser can now parse all of Fortran 2018 syntax to AST. A smaller subset can be transformed into ASR and even smaller subset compiled via LLVM to machine code. We are now working on extending the subset that LFortran can fully compile until we reach full Fortran 2018 support.

  • 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.

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).