Flang is a Fortran compiler developed as part of the LLVM project. It provides a language frontend for parsing, analysing, and compiling Fortran programs using LLVM’s compiler infrastructure. Flang is designed to support scientific computing, numerical analysis, and other applications where Fortran remains an important programming language.
The compiler uses a multi-stage compilation pipeline that includes parsing, semantic analysis, intermediate representation generation, optimisation, and machine-code generation. It introduces Fortran Intermediate Representation (FIR) and High-Level Fortran Intermediate Representation (HLFIR), which are based on LLVM’s MLIR infrastructure. These representations allow Fortran-specific language constructs to be analysed and transformed before being lowered to LLVM IR. Flang is distinct from the earlier Classic Flang compiler, which was developed separately from the implementation now included in LLVM.
This is free and open source software.
Key Features
- Fortran language frontend with parsing and semantic analysis.
- Compiler driver coordinates preprocessing, compilation, assembly, and linking.
- Generates native machine code through the LLVM compiler infrastructure.
- Fortran Intermediate Representation provides a dedicated representation of Fortran program semantics.
- High-Level Fortran Intermediate Representation preserves higher-level operations for compiler transformations.
- MLIR integration supports staged lowering and optimisation of program representations.
- Support for Fortran modules, derived types, arrays, procedures, and intrinsic operations.
- Handles many legacy Fortran language extensions alongside standard language constructs.
- OpenMP support for shared-memory parallel programming.
- Compiler diagnostics identify syntax errors, invalid declarations, and semantic problems.
- Preprocessor support for conditional compilation and macro processing.
- Optimisation passes take advantage of LLVM’s code-generation infrastructure.
- Runtime support for Fortran input/output and language-specific operations.
- Cross-platform support – runs on Linux and macOS.
Website: github.com/llvm/llvm-project/tree/main/flang
Support:
Developer: LLVM Project contributors
License: Apache License 2.0 with LLVM Exceptions
Flang is written in C++. Learn C++ with our recommended free books and free tutorials.
Related Software
| Compilers | |
|---|---|
| GNU Compiler Collection | The standard compiler for most Unix-like operating systems |
| rustc | Compiler for the Rust programming language |
| AOCC | AMD Optimizing C/C++ Compiler |
| LLVM | Low-Level Virtual Machine (LLVM) compiler for C/C++ |
| ispc | Intel SPMD Program Compiler |
| Babel | JavaScript compiler - use next generation JavaScript |
| Glasgow Haskell Compiler | An optimizing compiler for Haskell, written in Haskell |
| Clang | C Language Family Frontend for LLVM |
| Nuitka | Optimizing Python compiler |
| CHICKEN | Compiler for the Scheme programming language |
| FreeBASIC | 32-bit BASIC compiler |
| Numba | Compiler for Python array and numerical functions |
| Free Pascal | Advanced Pascal compiler for Pascal and Object Pascal |
| NASM | Assembler for the x86 CPU architecture |
| Bigloo | Practical Scheme compiler |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.