Install Lfortran

Lfortran is a unique Fortran compiler in that it is:

  • Interactive (or compiles as usual from command line)
  • works with Jupyter notebook
  • targets modern Fortran
  • loads module files from other compilers

Quite a unique feature set, but still quite experimental.

Install

This method is for installing Lfortran from the Git repo in Linux / Windows Subsystem for Linux. It assumes Anaconda / Miniconda Python.

  1. install Java JRE

    apt install default-java
    1. install Antler ```sh mkdir ~/ext cd ~/ext

    curl -O https://www.antlr.org/download/antlr-4.7.2-complete.jar ```

  2. setup Python for Lfortran

    conda create -n lfortran python=3.7 pytest llvmlite prompt_toolkit
    conda activate lfortran
    pip install antlr4-python3-runtime
    1. add Antlr to path: sh export CLASSPATH="$HOME/ext/antlr-4.7.2-complete.jar:$CLASSPATH"
  3. clone Lfortran repo

    cd ~
    git clone https://gitlab.com/lfortran/lfortran
    cd lfortran
    1. complete Lfortran install sh ./build.sh

Run the selftest

pytest