End users (and distributions) are encouraged to use the tarball, which only
depends on Python and a few Python packages (llvmlite
, pytest
,
prompt_toolkit
and antlr4-python3-runtime
). The LFortran standard library
needs to be compiled and it needs a C compiler. Down the road (see our
roadmap), LFortran will be gradually rewritten in C++, so it will
also depend on a C++ compiler.
The tarball is generated automatically by our CI (continuous integration) and contains some autogenerated files: the parser, which is generated by ANTLR4 (requires Java) and the AST and ASR nodes, which is generated by an ASDL translator (requires Python). The Java requirement is only needed when using git directly, the tarball does not depend on Java in any way.
This is the easiest way. Download the latest tarball from https://lfortran.org/download/.
Install prerequisites and LFortran (works on Linux, macOS and Windows):
conda create -n lfortran python=3.7 pytest llvmlite prompt_toolkit cmake make
conda activate lfortran
pip install antlr4-python3-runtime scikit-build
wget https://lfortran.github.io/tarballs/release/lfortran-0.1.12.tar.gz
tar xzf lfortran-0.1.12.tar.gz
cd lfortran-0.1.12
pip install .
Now the lfortran
environment has the lfort
compiler available, you can
start the interactive prompt by executing lfort
, or see the command line
options using lfort -h
.
Note: besides the above prerequisites installed by conda
, you also have to
have a C compiler.
Note on macOS: if wget
is not present, use curl -O
instead.
Optional: run tests:
pytest --pyargs lfortran
This works both on Linux, macOS and Windows:
conda create -n lfortran python=3.7 pytest llvmlite prompt_toolkit cmake make
conda activate lfortran
pip install antlr4-python3-runtime scikit-build
Install Java and then ANTLR, say, into ~/ext
:
export CLASSPATH="$HOME/ext/antlr-4.7-complete.jar:$CLASSPATH"
Build:
./build.sh
Run tests:
pytest
Run an interactive prompt:
./lfort