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.
Website: https://lfortran.org/
Try online: https://dev.lfortran.org/
Try LFortran in a JupyterLite notebook:
To build and run that JupyterLite site locally, use pixi run lab and open
http://localhost:8000/lab/index.html. See
doc/src/jupyterlite.md for details and for how to
write tests for bugs found in the lab.
Pixi is the recommended workflow for dependencies, builds, and tests. It installs the dependencies declared by the repository and runs the build; no separate package installation is needed. Native tasks default to LLVM 11:
git clone https://github.com/lfortran/lfortran.git
cd lfortran
pixi run build
pixi run start --version
pixi run start examples/expr2.f90The last command compiles and runs the program. To keep an executable, pass
-o <filename> to start.
On macOS, install Xcode Command Line Tools first; on Windows, use an initialized MSVC developer shell with Git Bash. Linux C/C++ compilers are provided by Pixi. See the Pixi installation guide for platform details. AI contributors must follow the required Pixi toolchain policy; use Pixi to supply project dependencies rather than installing packages with system or global package managers.
After building, run all three test suites with LLVM 11 from the repository root:
pixi run ctest -j8 > unit.log 2>&1
pixi run tests -j8 > reference.log 2>&1
pixi run integration_tests -j8 > integration.log 2>&1Inspect the saved test logs. Reference tests and updates require LLVM 11;
the tests task verifies the compiler's LLVM version before running. For a
focused test, append -t <pattern> to tests or integration_tests.
Other Pixi configurations build separately under build/<environment>:
pixi run -e llvm22 build
pixi run -e llvm22 start --version
pixi run -e llvm22 integration_tests -j8 > integration-llvm22.log 2>&1Use -e <environment> consistently to select another build.
pixi run clean cleans the default configuration's build targets.
Dependency and build details live in pixi.toml and its scripts.
All documentation, installation instructions, motivation, design, ... is available at:
Which is generated using the files in the doc directory.
We welcome all contributions. The main development repository is at GitHub:
https://github.com/lfortran/lfortran
Please send Pull Requests (PRs) and open issues there.
See the CONTRIBUTING document for more information.
Main mailinglist:
You can also chat with us on Zulip ().
Note: We moved to the above GitHub repository from GitLab on July 18, 2022.
You can support LFortran's development by donating to NumFOCUS or Open Collective as well as GitHub Sponsors:
- https://numfocus.org/donate-to-lfortran
- https://opencollective.com/lfortran
- https://github.com/sponsors/lfortran
All donations will be used strictly to fund LFortran development, by supporting tasks such as paying developers to implement features, sprints, improved documentation, fixing bugs, etc.
The donations to LFortran are managed by the NumFOCUS foundation. NumFOCUS is a 501(c)3 non-profit foundation, so if you are subject to US Tax law, your contributions will be tax-deductible.
If you want to discuss another way to fund or help with the development, feel free to contact Ondřej Čertík (ondrej@certik.us).
For packaging or an existing non-Pixi installation, see the optional alternatives at the end of the installation guide. Use Pixi above for development and tests.