How can I easily convert FORTRAN code to Python code (real code, not wrappers)

前端 未结 2 1079
忘了有多久
忘了有多久 2020-12-31 04:48

I have a numerical library in FORTRAN (I believe FORTRAN IV) and I want to convert it to Python code. I want real source code that I can import on any Python virtual machin

2条回答
  •  感动是毒
    2020-12-31 04:55

    I wrote a translator that converts a subset of Fortran into Python (and several other languages). It is only compatible with a small subset of Fortran, but I hope it will still be useful.

    The translator can parse this Fortran function:

    LOGICAL function is_greater_than(a, b) 
        real,intent(in) :: a
        real,intent(in) :: b 
        is_greater_than = a

    ...and translate it into this Python function:

    def is_greater_than(a,b):
        return a

提交回复
热议问题