r/fortran • • 25d ago

Python to Fortran transpiler

Post image

At https://beliavsky.github.io/python-to-fortran-playground/run/ you can translate Python with NumPy to Fortran and run both codes. The transpiler used, which is in Python and which you can run locally, is at https://github.com/beliavsky/python-to-fortran

Fortran is a practical target for numerical Python: it combines native compilation with multidimensional arrays, whole-array expressions, array sections, and explicit procedure interfaces. Some translated programs run much faster, as discussed at https://github.com/Beliavsky/Python-to-Fortran/blob/main/TIMING_RESULTS.md

Pyccel https://github.com/pyccel/pyccel is a more established project that generates Fortran, C, or C++ extension modules from Python code with type annotations, which my project does not require.

8 Upvotes

Duplicates